INTO OUTFILE
commands as seen below.My sample MySQL outfile commands:
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';
Do you guys know a MySQL command in which the INTO OUTFILE
files go directly into a zip file without being stored as 3 additional separate files onto the disk?
I just read your question and I found the answer in the same time while I was looking for the same feature. So I share what I found : Unfortunately, it seems that MySQL doesnt support direct output compression, this feature is requested but not implemented yet :
The best way in my knowledge to do that would be to do it in two steps :
Joffrey