Skip to main content


Showing posts from April, 2019

MySQL LOAD DATA from csv file into partitioned table

MySQL LOAD DATA from .csv file into partitioned table: MySQL load data into the MySQL partitioned table, from .csv file which has 63 column and table has 43 columns, column 43 of the table is loaddate and it's value will be current date. Here we are not loading some data from .csv file means skip data from .csv file and load selected data into the table. Table created with column loaddate, loaddate is part of primary key, table is partitioned on loaddate: CREATE TABLE CCB_SV_SVSEEK_1 ( Col_1, Col_2, Col_3, Col_4, .... Col_42  loaddate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,  PRIMARY KEY(Col_1,Col_2,Col_3,Col_4,Col_5,LOADDATE),  )  PARTITION BY RANGE COLUMNS (LOADDATE)(  PARTITION 2019_JAN VALUES LESS THAN ('2019-02-01') ,  PARTITION 2019_FEB VALUES LESS THAN ('2019-03-01') , ... PARTITION 2019_DEC ....  PARTITION 2019_ONWARDS VALUES LESS THAN MAXVALUE ); Code to load data from .csv file to table: LOAD DATA INFILE '/mysql/admin/scripts/<Table_Name>.cs