INTO OUTFILE
命令如下所示。我的示例MySQL outfile命令:
SELECT customer_id, firstname, surname FROM customers
INTO OUTFILE '/tmp/customers.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';
SELECT item_id, itemname, item_plu FROM items
INTO OUTFILE '/tmp/items.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';
SELECT invoice_id, invoice_total FROM invoices
INTO OUTFILE '/tmp/invoices.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n';
你们是否知道一个MySQL命令,其中INTO OUTFILE
文件直接进入一个zip文件,而不是作为3个额外的单独文件存储到磁盘上?
答案 0 :(得分:1)
我刚看了你的问题,我在寻找相同功能的同时找到了答案。所以我分享我发现的东西: 不幸的是,似乎MySQL不支持直接输出压缩,这个功能已被请求但尚未实现:
据我所知,这样做的最好方法是分两步完成:
乔佛