 -- --------------------------------------------------------
 
   CREATE TABLE D_ICD_DIAGNOSES
-   (	ROW_ID INT, 
-	ICD9_CODE VARCHAR(10), 
-	SHORT_TITLE VARCHAR(50), 
-	LONG_TITLE VARCHAR(300)
+   (	ROW_ID INT,
+	ICD9_CODE VARCHAR(10),
+	SHORT_TITLE VARCHAR(50),
+	LONG_TITLE VARCHAR(255)
    ) ;
 
 -- --------------------------------------------------------

--    CURR_SERVICE VARCHAR(255) NOT NULL);

LOAD DATA LOCAL INFILE 'SERVICES_DATA_TABLE.csv' INTO TABLE SERVICES
   FIELDS TERMINATED BY ',' ESCAPED BY '\\' OPTIONALLY ENCLOSED BY '"' 
   LINES TERMINATED BY '\n'
   IGNORE 1 LINES
   (@ROW_ID,@SUBJECT_ID,@HADM_ID,@TRANSFERTIME,@PREV_SERVICE,@CURR_SERVICE)

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

  CREATE TABLE PRESCRIPTIONS
   (	ROW_ID BIGINT,
	SUBJECT_ID INT,
	HADM_ID INT,
	ICUSTAY_ID INT,
	STARTTIME DATETIME,
	ENDTIME DATETIME,
	DRUG_TYPE VARCHAR(100),
	DRUG VARCHAR(100),
	DRUG_NAME_POE VARCHAR(100),
	DRUG_NAME_GENERIC VARCHAR(100),
	FORMULARY_DRUG_CD VARCHAR(120),
	GSN VARCHAR(200),
	NDC VARCHAR(120),
	PROD_STRENGTH VARCHAR(120),
	DOSE_VAL_RX VARCHAR(120),
	DOSE_UNIT_RX VARCHAR(120),
	FORM_VAL_DISP VARCHAR(120),
	FORM_UNIT_DISP VARCHAR(120),
	ROUTE VARCHAR(120)
   ) ;

