 -- --------------------------------------------------------
 
   CREATE TABLE NOTEEVENTS
-   (	ROW_ID BIGINT, 
-	RECORD_ID INT, 
-	SUBJECT_ID INT, 
-	HADM_ID INT, 
-	CHARTDATE DATETIME, 
-	CATEGORY VARCHAR(50), 
-	DESCRIPTION VARCHAR(300), 
-	CGID INT, 
-	ISERROR CHAR(1), 
+   (	ROW_ID BIGINT,
+	RECORD_ID INT,
+	SUBJECT_ID INT,
+	HADM_ID INT,
+	CHARTDATE DATETIME,
+	CATEGORY VARCHAR(50),
+	DESCRIPTION VARCHAR(255),
+	CGID INT,
+	ISERROR CHAR(1),
 	TEXT TEXT
    ) ;
 

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

  CREATE TABLE D_ITEMS
   (	ROW_ID BIGINT, 
	ITEMID INT, 
	LABEL VARCHAR(200), 
	ABBREVIATION VARCHAR(100), 
	DBSOURCE VARCHAR(20), 
	LINKSTO VARCHAR(50), 
	CODE VARCHAR(20), 
	CATEGORY VARCHAR(100), 
	UNITNAME VARCHAR(100), 
	PARAM_TYPE VARCHAR(30), 
	LOWNORMALVALUE DOUBLE PRECISION, 
	HIGHNORMALVALUE DOUBLE PRECISION
   ) ;


--    LOINC_CODE VARCHAR(255));

LOAD DATA LOCAL INFILE 'D_LABITEMS_DATA_TABLE.csv' INTO TABLE D_LABITEMS
   FIELDS TERMINATED BY ',' ESCAPED BY '\\' OPTIONALLY ENCLOSED BY '"'
   LINES TERMINATED BY '\n'
   IGNORE 1 LINES
   (@ROW_ID,@ITEMID,@LABEL,@FLUID,@CATEGORY,@LOINC_CODE)
