# Query CSV & JSON with SQL Online - In-Browser, with JOINs

> Run SQL on CSV, TSV and JSON files in your browser: type inference, WHERE, GROUP BY, aggregates, JOINs, CASE, subqueries and functions; export CSV or JSON.

- URL: https://qilingtools.com/en/csv-sql
- Category: Developer Tools (https://qilingtools.com/en/dev)
- Tags: [Developer](https://qilingtools.com/en/tags/dev), [Data Formats](https://qilingtools.com/en/tags/data)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

Got a few CSV or JSON files and want to filter, aggregate or join them without setting up a database? Drop the files in and each one becomes a table named after the file. Column types — number, text or boolean — are inferred automatically, empty cells become NULL, and IDs with leading zeros such as 00123 stay text. Then just write SQL: SELECT expressions with aliases, DISTINCT, WHERE with AND/OR/NOT, comparisons, LIKE, IN, BETWEEN and IS NULL, GROUP BY with COUNT, SUM, AVG, MIN, MAX, COUNT(DISTINCT), GROUP_CONCAT and MEDIAN, HAVING, multi-column ORDER BY with NULLS FIRST/LAST, LIMIT/OFFSET, INNER/LEFT/CROSS JOIN (equality conditions use a hash join), CASE WHEN, CAST, and string, math and date functions such as YEAR, MONTH, EXTRACT, STRFTIME, DATE_TRUNC and DATEDIFF. Subqueries work in FROM and IN. NULLs follow standard SQL three-valued logic. The query engine is a lightweight implementation written for this tool; grouping 100,000 rows usually takes tens of milliseconds. Errors point to the exact line and column and suggest the column you probably meant. The sidebar lists every table’s columns and types — click to insert — past queries are kept in a history, and the virtualized result grid exports to CSV (with a BOM so Excel reads it correctly) or JSON. Files are read only in your browser and never uploaded.

## How to use

1. Drop or choose CSV, TSV, JSON or NDJSON files (several at once), or load the sample data
2. Write SQL in the editor and press Ctrl/⌘ + Enter; click column names in the sidebar to insert them
3. Review the result grid, export it as CSV or JSON, and rerun anything from the history

## Features

- Multiple files as tables, renameable, with column type inference
- SELECT / WHERE / GROUP BY / HAVING / ORDER BY / LIMIT
- COUNT, SUM, AVG, MIN, MAX, COUNT(DISTINCT), GROUP_CONCAT, MEDIAN
- INNER, LEFT and CROSS JOIN, with hash joins on equality
- CASE WHEN, CAST and string, math and date functions
- Subqueries in FROM and IN, plus scalar subqueries
- Error messages with line, column and spelling suggestions
- Virtualized results, CSV/JSON export and query history

## FAQ

### Which SQL features are supported?

Single SELECT queries with DISTINCT, expressions and aliases, WHERE (AND/OR/NOT, =, <>, <, >, LIKE, IN, BETWEEN, IS NULL, IS DISTINCT FROM), GROUP BY (by alias or position too), HAVING, ORDER BY (several columns, ASC/DESC, NULLS FIRST/LAST), LIMIT/OFFSET, INNER/LEFT/CROSS JOIN and USING, CASE, CAST or x::int, and subqueries in FROM, in IN and as scalars. RIGHT/FULL JOIN, UNION, WITH, window functions and data-changing statements like INSERT or UPDATE aren’t supported.

### How are column types detected?

A column whose non-empty values are all numbers is numeric; all true/false makes it boolean; anything else is text. Empty cells are NULL. A value with a leading zero (a ZIP code like 00123 or an ID like 007) keeps the whole column as text so the zeros aren’t lost. Dates are stored as text — ISO dates (2024-03-01) compare correctly, and functions such as YEAR() and DATE_TRUNC() parse them. Nested JSON objects are flattened into parent_child columns and arrays are kept as JSON text.

### How are NULLs and sorting handled?

Standard SQL three-valued logic applies: comparing NULL with anything yields NULL, and WHERE keeps only rows where the condition is true, so salary <> 4000 skips rows with no salary, and NOT IN with a NULL in the list returns nothing. COUNT(column) skips NULLs, SUM and AVG ignore them, and on zero rows SUM returns NULL while COUNT returns 0. NULLs sort first in ascending order and last in descending order (as in SQLite and MySQL); use NULLS FIRST or NULLS LAST to change that. Sorting is stable, so tied rows keep their original order.

### How large can the files be?

All data lives in your browser’s memory, so hundreds of thousands of rows or tens of megabytes of CSV are usually fine; grouping, joining or sorting 100,000 rows typically takes under a tenth of a second. Equality joins use a hash join; joins without an equality condition compare every pair of rows and are refused above 50 million combinations. For bigger data, filter with WHERE first or split the file.

## Related tools

- [JSON Formatter](https://qilingtools.com/en/json): Free online JSON formatter: beautify or minify, validate with the exact line and column of any error, browse a collapsible tree, sort keys and escape strings.
- [Base64 Encode/Decode](https://qilingtools.com/en/base64): Free online Base64 encoder and decoder: UTF-8 safe, optional URL-safe variant, convert text to Base64 and back in real time. Processed locally, never uploaded.
- [URL Encode/Decode](https://qilingtools.com/en/url-encode): Free online URL encoder and decoder with encodeURIComponent and encodeURI modes. Escapes Chinese, spaces and special characters. Real-time and local, no upload.
- [JWT Decoder](https://qilingtools.com/en/jwt): Free online JWT decoder: decode the header and payload of a JSON Web Token, show expiry and issued-at times, all locally without uploading the token.
- [Timestamp Converter](https://qilingtools.com/en/timestamp): Free online Unix timestamp converter: convert timestamps and dates, auto-detect seconds or milliseconds, and show local, UTC, ISO 8601 and relative time.
- [Hash / Checksum](https://qilingtools.com/en/hash): Free online hash calculator: SHA-1, SHA-256, SHA-384 and SHA-512 of text or any file through the browser crypto API. Files never leave your device.
- [UUID Generator](https://qilingtools.com/en/uuid): Free online UUID generator: create RFC 4122 UUID v4 in bulk with a cryptographic RNG. Options for uppercase, no hyphens and braces, with one-click copy.
- [Base Converter](https://qilingtools.com/en/base-convert): Free online number base converter: convert between binary, octal, decimal, hexadecimal and any base 2–36. Uses BigInt for huge integers, computed locally.
