sql 将数据写入CSV文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 将数据写入CSV文件相关的知识,希望对你有一定的参考价值。

\!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

以上是关于sql 将数据写入CSV文件的主要内容,如果未能解决你的问题,请参考以下文章