\!h Example - exporting list of artists from the music db into a csv file:
-- the data the we want to export:
SELECT artist_name, album_name FROM
artist, album WHERE artist.artist_id = album.artist_id;
-- written as an export select query:
SELECT artist_name, album_name FROM
artist, album WHERE artist.artist_id = album.artist_id
INTO OUTFILE '/tmp/artists_and_albums.csv' FIELDS TEMINATED BY ',';
-- NOTE: without FIELDS TEMINATED BY, the default separator is tab