Category Archives: Web

Posts related to web design and programming web applications.

Save SQL result into file

Often it is useful to export a SQL query result into a file. Especially CSVfiles are nice for this task. The following SQL query saves the result in a file called output.csv into the /tmp directory: SELECT * FROM my_table INTO OUTFILE ‘/tmp/output.csv’ FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’;

Read more