Save query results as csv

@Joe_Foley

Thanks for posting. Let me preface my response with: We (Zetetic) didn’t create DB Browser for SQLite

I’m unsure if the desired functionality exists within the current interface but @justinclift would know for sure.

You could adjust your query to create a new table based on your current SELECT statement and then print out the newly created table as a CSV.

So take this example table:

Sample_Books_Table

Let’s say the query you want to export is:

SELECT title, author FROM books WHERE price > 10;

You could adjust it to be:

CREATE TABLE books_10 AS SELECT title, author FROM books WHERE price > 10;

Which would generate a table like:

books_10_table

Then you can go to File → Export → Export Table(s) as CSV and select the newly created table generated by your query (books_10) in the example here.

After exporting you’ll most likely want to run a query to discard the table that was created by the SELECT statement, something like:

DROP TABLE books_10;

Hope this helps!

Cheers,
Micah