1

this may just be the dumbest question I have asked yet. But I can not figure this out. I am trying to import a CSV into my mysql. But I can not get these areas correct:

Columns separated with: Columns enclosed with: Columns escaped with: Lines terminated with:

Here is an example row in mycsv: AA|Armed Forces Americas|US|United States

what would I place in each one?

1
  • That's not a CSV per se. Commented Apr 12, 2012 at 20:17

1 Answer 1

1

If you have table that match the column configuration of the file what you do is:

LOAD DATA INFILE '<full file path>`
INTO TABLE <tbl_name>
FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n';

If some of the fields may contain | then these fields should be enclosed by " and then the last clause becomes:

FIELDS TERMINATED BY '|' ENCLOSED BY '"' TERMINATED BY '\n'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.