I'm testing a small sample of a CSV file to be uploaded into MySQL.
However the LOAD DATA INFILE command is missing the first column and I don't know how to get it in.
It always puts my second column from CSV into the first column.
Here is the database;
Now, here is the CSV file.Code:; Pseduocode Database id (primary key, auto_increment, int) OfferProcessType (var 32) TradingName (var 32)
And here is my MySQL call;Code:OfferProcessType,TradingName E, A,My Travel
Problems;Code:LOAD DATA INFILE 'testy.csv' INTO TABLE `testy` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' ;
1. For some reason this call does not pull in my first column. How do I get it to read the first column and put it into the database?
2. How do I ensure that the columns in the CSV file are the same as those in MySQL?
3. How do I make sure MySQL does not import the column names, or any blank rows (in my example the second row is empty).
I am currently adding this line: "IGNORE 2 LINES;" into my MySQL call.
This removes the first 2 rows, but I don't know if this is the right way to do it.








Bookmarks