To dump data from the database into an Excel file, SELECT query can be used to convert data to CSV formatting.
Converting MySQL query results into a CSV file
All needs to be done is to identify how the fields and lines should be terminated. For example, to dump a table named customers to a CSV file named customers.csv, execute this command:
mysql>SELECT * FROM users INTO OUTFILE ‘/home/testaccnt/users.csv’ FIELDS TERMINATED BY ‘\t\’ ->LINES TERMINATED BY ‘\n’;
All you need to do is identify how the fields and lines should be terminated. For example, to dump a table named users to a CSV file named users.csv, execute this command:
mysql>SELECT * FROM users INTO OUTFILE ‘/home/jason/users.csv’
FIELDS TERMINATED BY ‘\t\’ ->LINES TERMINATED BY ‘\n’;All you need to do is identify how the fields and lines should be terminated. For example, to dump a table named users to a CSV file named users.csv, execute this command:
mysql>SELECT * FROM users INTO OUTFILE ‘/home/jason/users.csv’
FIELDS TERMINATED BY ‘\t\’ ->LINES TERMINATED BY ‘\n’;