Importing CSV to MySQL with Load Data Infile

I'm trying to load a CSV file into MySQL, and I keep getting syntax errors:

load data infile 'c:/worldminwage.csv' fields terminated by ',' enclosed
by '"' lines terminated by '\n' (YearlyWage, PercentGDP, Date
effective);

Can anyone help me get this working? Thanks.

Answers


Valid syntax is LOAD DATA INFILE 'c:/worldminwage.csv' INTO TABLE tablename.

You forgot to mention which table the data should go in. See LOAD DATA INFILE Syntax


I think This would be more batter

LOAD DATA INFILE 'c:/worldminwage.csv' fields terminated by ',';

Because you will get rid of error like columns numbers are not matching in the .csv file and mysql table


Need Your Help

What's a good example of register variable usage in C?

c cpu-registers kernighan-and-ritchie kr-c

I'm reading through K&R and came to the small section on register variables, and was wondering if people here have some good examples of this put into practice.

Changing memory settings in eclipse.ini causes Could not create JVM

java eclipse jvm

I have a following problem. When I try to raise memory for JVM in eclipse.ini file, I always get Could not create Java Virtual Machine exception.