0

I have database with many tables. From that I want to export a table with only selected fields. For instance table has 52 fields. Out of that I only require only few fields.

I am using following syntax but not working after upgrade of my Ubuntu.

mysqldump -u user -p db table --where="SELECT name, dob FROM table" > ab.sql

What is the proper way to mysqldump selected fields of table?

undefined_variable
  • 6,180
  • 2
  • 22
  • 37
tapaljor
  • 237
  • 1
  • 6
  • 21
  • 1
    I don't think certain columns can be selected when using `mysqldump`. But according to [this Stack DA](http://dba.stackexchange.com/questions/34887/mysqldump-tables-excluding-some-fields) article, you could create a view and dump that, or use `SELECT ... INTO OUTFILE` if you are OK with CSV data. – Tim Biegeleisen Jul 29 '16 at 09:47
  • I would also go for an interim table or a view. – Jakumi Jul 29 '16 at 09:57
  • Does this answer your question? [How to take mysql dump of selected columns of a table](https://stackoverflow.com/questions/15264597/how-to-take-mysql-dump-of-selected-columns-of-a-table) – miken32 Nov 28 '19 at 18:46

0 Answers0