使用Select * from table into outfile 导出到本地的csv文件没有表头,只有数据行。需要把列名也导出到csv文件中怎么设置呢?

Viewed 19

SELECT k1 FROM tbl1 UNION SELECT k2 FROM tbl1
INTO OUTFILE "file:///path/to/result_"
FORMAT AS CSV
PROPERTIES(
"column_separator" = ","
);
是需要在PROPERTIES中补充一个什么参数吗?官方文档中没有提及呢?

1 Answers

使用format_as:CSV_WITH_NAMES_AND_TYPES或CSV_WITH_NAMES即可