export to csv in sql terminal code example
Example: mysql output csv
-- If you are using linux,
SELECT id, filename
FROM attachments
INTO OUTFILE '/tmp/results.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
-- and find the csv file /tmp