I have a file with lots of columns and I want to enter this file into mysql table.
The fact is that if we have a file with, say, 8 columns, then we will first create a table with
CREATE TABLE `input` ( `idInput` varchar(45) DEFAULT NULL, `row2` varchar(45) DEFAULT NULL, `col3` varchar(45) DEFAULT NULL, `col4` varchar(45) DEFAULT NULL, `col5` varchar(45) DEFAULT NULL, `col6` varchar(45) DEFAULT NULL, `col7` varchar(45) DEFAULT NULL, `col8` varchar(45) DEFAULT NULL );
then we will enter the file using
LOAD DATA INFILE "FILE" INTO TABLE input;
But the fact is, I have a file with 150 columns, and I want to automatically insert this file into the mysql table (so that I do not have to create the table first). The first line of my file is the header, and it should be both the column names in the table and each column, and each row has a different data type.
So, is there an easy way to do this so that after that I can do different things with this table?
I am using the mysql client command line version 5.5.20 (Windows 7).
Vikas source share