SQLite: How do I save the result of a query as a CSV file?

后端 未结 6 2037

I\'m new to SQLite. Is there a way I can export the results of a query into a CSV file?

6条回答
  •  孤城傲影
    2020-11-28 01:35

    In addition to the above answers you can also use .once in a similar way to .output. This outputs only the next query to the specified file, so that you don't have to follow with .output stdout.

    So in the above example

    .mode csv
    .headers on
    .once test.csv
    select * from tbl1;
    

提交回复
热议问题