How would I Export tables specifying only certain fields?
I am using mysql 5.0 – using either a sql command or mysqldump.
My table is X, and the fields I want to export are A,B,C
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need the FILE privilege to do this, and it won’t overwrite files.
INTO OUTFILEhas a bunch of options to it as well, such asFIELDS ENCLOSED BY,FIELDS ESCAPED BY, etc… that you may want to look up in the manual.To produce a CSV file, you would do something like:
To load the data back in from the file, use the
LOAD DATA INFILEcommand with the same options you used to dump it out. For the CSV format above, that would be