Forum Moderators: coopster
FIELDS TERMINATED BYtells where a field ends.
FIELDS [OPTIONALLY] ENCLOSED BYcontrols quoting of fields. For output (SELECT ... INTO OUTFILE), if you omit the word OPTIONALLY, all fields are enclosed by the ENCLOSED BY character.
FIELDS ESCAPED BYcontrols how to write special characters.
If you don't specify a FIELDS clause, the defaults are the same as if you had written this:
FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\'
Example:Let's say we use something like this:
FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\'Our data should be formatted with the fields enclosed in double quotation marks, separated by commas, and any special characters escaped with a single slash:
"field 1", "field 2", "field 3", "field 4 with slash \\ character in it"
Resources:
LOAD DATA INFILE [dev.mysql.com]
SELECT [dev.mysql.com]
in phpMyAdmin, what is the different between "field terminated by" and "filed enclosed by" and "field escape by"? how do I set all these?
Speaking from experience, you need to change "field terminated by" to whatever comes between each field in the .csv file (viewed in notepad, not excel). If you exported to .csv, this is a comma. Change the semicolon to a comma.
I've never had to mess with "fields escaped by" and I doubt you'd have to either.