I’m new to SQL and I’m just having a little difficulty with the syntax for load data infile.
So my data is in the format below and I’ve created a table with 2 columns one for ints and another for varchars.
0,Albert
1,America
2,American
3,April
4,Austrian
5,Badcock's
This is the code I was trying but it just puts everything into the first row of the varchar column, could someone point me in the right direction? Thanks
load data infile 'C:/temp/correct.csv'
into table correct_spellings
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'
Since you’ve copied+pasted your data, it is impossible to tell whether lines are truly terminated by
\r\n.I suggest that you first try without the
LINES TERMINATED BY...clause. Let MySQL auto-detect this for you.If this does not work, try again, this time with only
\n, or only\r.Sorry – I can’t provide with a definite answer, you’ll have to test…