 ALTER TABLE IOEVENTS
 ADD CONSTRAINT ioevents_fk_icustay_id
   FOREIGN KEY (icustay_id)
-  REFERENCES icustayevents(icustay_id);
+  REFERENCES icustays(icustay_id);
 
 -- cgid
 ALTER TABLE IOEVENTS

ALTER TABLE DATETIMEEVENTS
ADD CONSTRAINT datetimeevents_fk_icustay_id
  FOREIGN KEY (icustay_id)
  REFERENCES icustayevents(icustay_id);


-----------------

ALTER TABLE TRANSFERS
ADD CONSTRAINT transfers_fk_icustay_id
  FOREIGN KEY (icustay_id)
  REFERENCES icustays(icustay_id);
