Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a csv file having 5 columns and i want to load only one out of that, is there a way i can do it. I want to use LOAD statement of MySQL 5.5 Any pointers are welcomed, help would be much appreciated

share|improve this question
This is covered in the documentation – Kermit May 15 '13 at 15:28
up vote 6 down vote accepted

From the documentation:

You can also discard an input value by assigning it to a user variable and not assigning the variable to a table column:

  (column1, @dummy, column2, @dummy, column3);
share|improve this answer
I have gone through the documentation, but i have a csv file say - 46,94,43,12 now i want to discard the third column, LOAD DATA INFILE 'file.txt' INTO TABLE t1("WHAT SHOULD I WRITTE HERE?? THE COLUMN NAMES??)... Thanks for your time Phil.. – Hitesh Chouhan May 16 '13 at 4:54
LOAD DATA INFILE 'file.txt' INTO TABLE t1 (column1, column2, @discard3, column4); – Phil May 16 '13 at 5:02
Thanks a lot phil.. – Hitesh Chouhan May 16 '13 at 5:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.