Coginiti menu Coginiti menu

Export Data

How to Export Data in SQL

To export data from a SQL database, you can use the SELECT … INTO OUTFILE or the SELECT … INTO DUMPFILE clause to write the query results to a file in a specified format. Here are two examples of exporting your data to a file:

Using a SELECT … INTO OUTFILE clause

SELECT column1, column2, ...  
FROM table_name 
WHERE condition 
INTO OUTFILE 'C:/output/data.csv' 
FIELDS TERMINATED BY ','  
ENCLOSED BY '"' 
LINES TERMINATED BY '\n';

This query will export the columns from the table_name to a file called data.csv in the C:\output directory. You can specify your filter conditions in a WHERE clause if needed.

Using a SELECT … INTO DUMPFILE clause

SELECT column1  
FROM table 
WHERE id = 123 
INTO DUMPFILE '/path/to/file.pdf';

If you use Coginiti Pro, you can click “Export” to download the data as a CSV, TSV, or XLSX. It’s also possible to Copy to Clipboard and paste the data where you want.

Exporting data in Coginiti

If you need to change the delimiter and other details, apply your preferences before exporting.

How to change the delimiter before export data in Coginiti

Note that you may need to adjust the file path and column names to match your database schema.