MYSQL Exporting CSV Files Vs Exporting SQL


MYSQL Exporting CSV Files Vs Exporting SQL

With phpMyAdmin, you can export table data in all sorts of formats; such as sql and csv. However, you should make the best effort to ensure you get the data you want. When you select specific values from a table or do a relational database query with 2-4 tables, phpMyAdmin will display the data for which is seeked. However, if you want to export the exact tuples and values of desired data; you will want to export as a csv file. Howver, you will want to use the export command near the bottom of the page. To export that csv file, look for 'Query results operations at the bottom of the page.

To export a relational database query or custom set of tuples,
1) Select Query results operations >Export >Choose CSV (for compatibility)
2) The csv file can be opened in Excel for viewing purposes.

Note:
If you export a sql file it will give entire table even though your query created custom columns with custom values.  But, if you export a csv file and make a new table with same column count you can import the csv file into a new table.

To import the csv file into a new database table,
1) Create a database table with the same number of columns.
2) Import the file into the new table.
3) Add a new column with autoincrement field if desired. The column will populate automatically.