Export Table from Database to CSV File

automatic Export Data From Database to CSV File

Finally, I found a beautiful tutorial to export data from Database to CSV File.

Also one answer on Stackoverflow.

sqlcmd -S . -d DatabaseName -E -s, -W -Q "SELECT * FROM TableName" > C:\Test.csv

How to export a large table in csv format with 8 millions rows in mysql?

Have you tried with Select OUTFILE?

The solution:

SELECT 
orderNumber, status, orderDate, requiredDate, comments
FROM
orders
WHERE
status = 'Cancelled'
INTO OUTFILE 'C:/tmp/cancelled_orders.csv'
FIELDS ENCLOSED BY '"'
TERMINATED BY ';'
ESCAPED BY '"'
LINES TERMINATED BY '\r\n';

Export SQL table in CSV With Headers

This works for me. What version of phpmyadmin do you have?

  1. Under Browse, click on the table you want to export.
  2. At the bottom, in the Query results operations section, click on Export.
  3. In Export method, choose Custom.
  4. Change Format to CSV for MS Excel.
  5. Under Format-specific options, check Put columns names in the first row.


Related Topics



Leave a reply



Submit