I am aware of the --where condition while taking dump of table where we can give condition on rows. But I have a table of the size 15GB and have over 100 columns.I need a dump of few columns out of it, and I want to do this as scheduled job where I will take dump of few columns of the source DB and store it to another server for reporting purpose.I also tried INTO OUTFILE but It won't save output as .sql and as INSERT statement.

1 Answer 1


Create a view v_ip that contains only the columns you want, and then dump that view into a csv file.

select * from v_ip into outfile '/tmp/test.sql'
   fields terminated by ','
   enclosed by '"'
   lines terminated by '\n';

Importing should be done with "load data".

Your Answer

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

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