I have 31 csv file in my pc. I want to load all these csv file into a single table in mysql. is there anyway to do this using sql query??
3 Answers
Assuming your pc is a windows pc, if yes then use below command one by one for each file-
LOAD DATA INFILE 'c:\\temp\\your_file.csv'
INTO TABLE table_name
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
If you don't have header line then remove "IGNORE 1 LINES".
If you are using linux or mac then there will be little bit change in syntax.