Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I am having a CSV file. It holds 1.4 million rows of data, therefore I am not able to open this CSV file in Excel because its limit is about 1 million rows only.

Hence, I need to import this file in MySQL workbench. This CSV file holds columns like:

"Service Area Code","Phone Numbers","Preferences","Opstype","Phone Type"

I am attempting to create a table in MySQL workbench named as "dummy" containing columns like:

ServiceAreaCodes,PhoneNumbers,Preferences,Opstyp,PhoneTyp. 

The CSV file is named model.csv. My code in the workbench is like this:

LOAD DATA LOCAL INFILE 'model.csv' INTO TABLE test.dummy FIELDS TERMINATED BY ',' lines terminated by '\n';

However, I am getting an error like model.CSV file not found.

1 Answer

0 votes
by (12.7k points)

I suppose you're missing the ENCLOSED BY clause

LOAD DATA LOCAL INFILE '/path/to/your/csv/file/model.csv'
INTO TABLE test.dummy FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\n';

And mention/give the CSV file full path.

Want to become an expert in SQL? Join the SQL course fast!

Related questions

0 votes
1 answer
asked Jul 11, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked Dec 17, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...