SQL guide

Query CSV files with SQL

SQL is useful when a CSV export needs the same filtering rules every week. Start with one file and a small preview before writing your full calculation.

  1. Open a CSV export

    Add the file in Workspace and inspect the table alias and column names. SnappySQL also supports TSV and gzip-compressed CSV.

  2. Check identifiers and amounts

    Keep identifiers as text when leading zeroes matter. Inspect dates and amounts for blanks, inconsistent separators, or unexpected text.

  3. Filter the rows

    Use WHERE to isolate the records you need. Save the query if you expect to run it again. Choose Export to write the result to a new file.

Example query

SELECT order_id, total
FROM orders
WHERE status = 'paid'
ORDER BY total DESC
LIMIT 50;

If order IDs or monetary values have been inferred as the wrong type, inspect the source and use a deliberate cast before comparing or summing.