- Home
- Manipulate CSV
- CSV Query
Query CSV with SELECT, WHERE & ORDER BY
Query a CSV with SELECT, WHERE, GROUP BY, ORDER BY, and LIMIT
Run a real SQL query against one CSV file in your browser. Queries use the table name data, for example: SELECT name, email FROM data WHERE status = 'active' AND signups > 10 ORDER BY name ASC LIMIT 100. Conditions combine freely with AND, OR, NOT, and parentheses, and every clause is parsed properly rather than pattern-matched.
Summaries work too: GROUP BY a column and use COUNT, SUM, AVG, MIN, MAX, or GROUP_CONCAT, then narrow the groups with HAVING. Text comparisons ignore case, columns that hold numbers compare as numbers, and empty cells behave as NULL. JOIN and subqueries are still out of scope — use CSV Joiner to match two files by key first.
Drop your file here or browse from your device
Accepts CSV, TSV, TXT. Maximum input: 10 MiB. Files above this hard limit are rejected before local processing.
How to Use
- Upload or paste one CSV file
- Write a query using SELECT columns FROM data
- Optionally add WHERE, GROUP BY, HAVING, ORDER BY, LIMIT, and OFFSET clauses
- Review and download the query result
Features
- SELECT columns, expressions, and DISTINCT rows
- WHERE with AND, OR, NOT, parentheses, LIKE, IN, BETWEEN, CONTAINS, and IS NULL
- GROUP BY with COUNT, SUM, AVG, MIN, MAX, GROUP_CONCAT, and HAVING
- ORDER BY several columns, aliases, or select positions, with LIMIT and OFFSET
- Errors that name the problem and point at the character that caused it
- Preview and download the query result as CSV
Use Cases
- Select only the columns needed for an import or handoff
- Filter records with several conditions at once, by status, text pattern, number, range, or empty value
- Count orders and total revenue per category without building a pivot table
- Sort a filtered export and page through it with LIMIT and OFFSET
Frequently Asked Questions
Do I need a database to run these queries?
No. The query runs against the parsed CSV in your browser, so there is nothing to install, no connection string, and no upload step before you can ask a question of your data.
Is my data private when querying a CSV?
The file is parsed and queried in your browser and its contents are not sent to the app server. As with any website, avoid opening highly sensitive files on a device or browser you do not trust.
What query syntax is supported?
SELECT with *, named columns, expressions, and DISTINCT; FROM data; WHERE with any number of conditions combined by AND, OR, NOT, and parentheses; GROUP BY with HAVING; ORDER BY several keys with optional ASC or DESC; and LIMIT with OFFSET. Comparisons include =, !=, <>, >, <, >=, <=, LIKE, NOT LIKE, IN, NOT IN, BETWEEN, NOT BETWEEN, CONTAINS, IS NULL, and IS NOT NULL.
Can CSV Query use GROUP BY, aggregates, or JOIN?
GROUP BY and aggregates yes: COUNT, COUNT(DISTINCT column), SUM, AVG, MIN, MAX, and GROUP_CONCAT, with HAVING to filter the groups. JOIN and subqueries are not supported, so use CSV Joiner to match two files on a shared key and then query the result.
Why does my WHERE clause with two conditions return nothing?
It should not. Conditions combine with AND, OR, and NOT in the usual precedence, so WHERE status = 'active' AND amount > 100 applies both tests. If a query returns nothing unexpectedly, check that text values are in single quotes and that the column names match the file exactly — the error message names any column it cannot find.
How are empty cells and text case handled?
An empty cell is NULL, so it is never equal or unequal to anything; find those rows with IS NULL. Text comparisons and LIKE ignore case, and a column whose values read as numbers is compared numerically, so amount > 100 works even though a CSV stores everything as text.
Related Tools
CSV Joiner
Join two CSV files on a common key column with database-style matching
CSV Pivot
Create pivot tables from CSV data, or unpivot wide data back to long format
CSV Viewer
View CSV files in a spreadsheet-style grid with sorting, filtering, and search
CSV Filter
Filter CSV rows by column conditions
CSV to SQL Converter
Convert CSV files to CREATE TABLE and INSERT statements
Parquet to CSV Converter
Convert Apache Parquet files to CSV format in your browser