How should I specify the columns names when I want to load a MySQL table from a local .csv file using the LOAD DATA LOCAL FILE command in MySQL?
-
I'm voting to reopen this, since the other question stackoverflow.com/questions/4202564/… has no accepted answer and an incorrect answer before the correct one. Close again if you disagree.ysth– ysth2019-12-06 21:17:34 +00:00Commented Dec 6, 2019 at 21:17
-
@ysth having an accepted answer is not a criterion for a dupe target and the most upvoted answer is a correct answer, altgough other answers there also work. Your answer is just a repeat of what's already there, confirming that is indeed a duplicate.Shadow– Shadow2019-12-06 22:15:26 +00:00Commented Dec 6, 2019 at 22:15
Add a comment
|
1 Answer
You specify a comma seperated list of columns, in parentheses, at the end (but before the optional SET parameters).
See https://dev.mysql.com/doc/refman/8.0/en/load-data.html#load-data-column-list