CSV Export

To export the data from a table to a CSV file, use the COPY statement:

COPY tbl TO 'output.csv' (HEADER, DELIMITER ',');

The result of queries can also be directly exported to a CSV file:

COPY (SELECT * FROM tbl) TO 'output.csv' (HEADER, DELIMITER ',');

For additional options, see the COPY statement documentation.

© Copyright 2018–2024 Stichting DuckDB Foundation
Licensed under the MIT License.
https://duckdb.org/docs/guides/file_formats/csv_export.html