 -- ----------
 
 -- subject_id
-CALL PROC_DROP_FOREIGN_KEY('SERVICES', 'services_fk_subject_id')
+CALL PROC_DROP_FOREIGN_KEY('SERVICES', 'services_fk_subject_id');
 ALTER TABLE SERVICES
 ADD CONSTRAINT services_fk_subject_id
   FOREIGN KEY (SUBJECT_ID)
   REFERENCES PATIENTS(SUBJECT_ID);
 
 -- hadm_id
-CALL PROC_DROP_FOREIGN_KEY('SERVICES', 'services_fk_hadm_id')
+CALL PROC_DROP_FOREIGN_KEY('SERVICES', 'services_fk_hadm_id');
 ALTER TABLE SERVICES
 ADD CONSTRAINT services_fk_hadm_id
   FOREIGN KEY (HADM_ID)

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

-- subject_id
CALL PROC_DROP_FOREIGN_KEY('CHARTEVENTS', 'chartevents_fk_subject_id')
ALTER TABLE CHARTEVENTS
ADD CONSTRAINT chartevents_fk_subject_id
  FOREIGN KEY (SUBJECT_ID)
  REFERENCES PATIENTS(SUBJECT_ID);

-- cgid
CALL PROC_DROP_FOREIGN_KEY('CHARTEVENTS', 'chartevents_fk_cgid')
ALTER TABLE CHARTEVENTS
ADD CONSTRAINT chartevents_fk_cgid
  FOREIGN KEY (CGID)
  REFERENCES CAREGIVERS(CGID);

-- hadm_id
CALL PROC_DROP_FOREIGN_KEY('CHARTEVENTS', 'chartevents_fk_hadm_id')
ALTER TABLE CHARTEVENTS
ADD CONSTRAINT chartevents_fk_hadm_id
  FOREIGN KEY (HADM_ID)
  REFERENCES ADMISSIONS(HADM_ID);

-- item_id
CALL PROC_DROP_FOREIGN_KEY('CHARTEVENTS', 'chartevents_fk_itemid')
ALTER TABLE CHARTEVENTS
ADD CONSTRAINT chartevents_fk_itemid
  FOREIGN KEY (ITEMID)
  REFERENCES D_ITEMS(ITEMID);

-- icustay_id
CALL PROC_DROP_FOREIGN_KEY('CHARTEVENTS', 'chartevents_fk_icustay_id')
ALTER TABLE CHARTEVENTS
ADD CONSTRAINT chartevents_fk_icustay_id
  FOREIGN KEY (ICUSTAY_ID)

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

-- subject_id
CALL PROC_DROP_FOREIGN_KEY('NOTEEVENTS', 'noteevents_fk_subject_id');
ALTER TABLE NOTEEVENTS
ADD CONSTRAINT noteevents_fk_subject_id
  FOREIGN KEY (SUBJECT_ID)
  REFERENCES PATIENTS(SUBJECT_ID);

-- hadm_id
CALL PROC_DROP_FOREIGN_KEY('NOTEEVENTS', 'noteevents_fk_hadm_id');
ALTER TABLE NOTEEVENTS
ADD CONSTRAINT noteevents_fk_hadm_id
  FOREIGN KEY (HADM_ID)
  REFERENCES ADMISSIONS(HADM_ID);

-- cgid
CALL PROC_DROP_FOREIGN_KEY('NOTEEVENTS', 'noteevents_fk_cgid');
ALTER TABLE NOTEEVENTS
ADD CONSTRAINT noteevents_fk_cgid
  FOREIGN KEY (CGID)
