1. Home
  2. Developer Tools
  3. SQL Compiler

Online SQL Compiler

Run SQL against ready-made sample tables, or upload a CSV and query your own data. Full SQLite with JOINs, CTEs and window functions — in your browser.

✓ Free✓ No Signup✓ CSV → SQL✓ Window Functions
query.sql
Tables

Query your own data

Or drop a file here. Up to 10 MB. The file is read in your browser and kept only until you close the tab — it is never uploaded to a server.

Output

Run a query to see the result table here.

⌘/Ctrl + EnterRun⌘/Ctrl + /Comment⌘/Ctrl + ZUndo⌘/Ctrl + Shift + ZRedoCode autosaves in this browser only — it is never sent to our servers.

Practise it · SQL

Top N, when there is a tie

LIMIT 3 looks right until two customers tie for third — write the top-N that keeps both. Medium · about 14 min · runs in your browser, no signup.

Four sample tables are loaded before you type anything: departments, employees, customers and orders. They are small on purpose — about 45 rows between them — but shaped to exercise real SQL: an employees.manager_id for self-joins, an order whose customer does not exist and a customer with no orders for anti-joins, NULLs where NULLs trip people up, and enough dates for running totals and month-over-month windows.

To query your own data, click Upload CSV (or drop the file on the Tables panel), give the table a name and press Load. Column types are inferred — whole numbers become INTEGER, decimals REAL, everything else TEXT — and values with leading zeros such as zip codes and phone numbers stay text. Quoted fields with commas, semicolon- and tab-separated files and Excel’s byte-order mark are all handled. The table lives until you close the tab and is never uploaded.

The database persists between runs, so you can CREATE TABLE in one query and SELECT from it in the next. Reset database rebuilds it from the samples plus your uploaded CSVs. A runaway query — a WITH RECURSIVE with no stopping condition — is stopped after 10 seconds and the database is rebuilt, with your uploads intact.

Frequently Asked Questions

Which SQL dialect does this online SQL compiler use?

SQLite 3, compiled to WebAssembly. It supports JOINs of every kind SQLite has, GROUP BY with HAVING, subqueries, CTEs including WITH RECURSIVE, window functions (ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, running SUM), UPSERT and JSON functions.

How do I run SQL queries on a CSV file?

Click Upload CSV on the Tables panel, choose the file, type a table name and press Load. The table appears next to the sample tables and you can JOIN it with them. Files up to 10 MB and 200,000 rows are supported.

Is my CSV uploaded to a server?

No. The file is read and loaded into a SQLite database inside your browser. It stays in memory until you close the tab and is never sent anywhere.

What sample tables are available?

departments (5 rows), employees (12), customers (8) and orders (20). Use the Preview button next to any table to see its rows, or expand it to see its columns and types.