Include headers when using SELECT INTO OUTFILE? Ask Question

Include headers when using SELECT INTO OUTFILE? Ask Question

Is it possible to include the headers somehow when using the MySQL INTO OUTFILE?

ベストアンサー1

You'd have to hard code those headers yourself. Something like:

SELECT 'ColName1', 'ColName2', 'ColName3'
UNION ALL
SELECT ColName1, ColName2, ColName3
    FROM YourTable
    INTO OUTFILE '/path/outfile'

おすすめ記事