Skip to content

Instantly share code, notes, and snippets.

@wipermail
Created March 24, 2023 12:01
Show Gist options
  • Save wipermail/67d9aef9ff8e69d5583d8fc64b67f025 to your computer and use it in GitHub Desktop.
Save wipermail/67d9aef9ff8e69d5583d8fc64b67f025 to your computer and use it in GitHub Desktop.
SELECT order_id,product_name,qty
FROM orders
WHERE foo = 'bar'
INTO OUTFILE '/var/lib/mysql-files/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
Note: That syntax may need to be reordered to
SELECT order_id,product_name,qty
INTO OUTFILE '/var/lib/mysql-files/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM orders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment