An online SQL compiler with a real SQLite database
This online SQL compiler runs genuine SQLite — the same database engine used in phones, browsers and countless apps — directly in your browser tab. Write a query, press Run and see the result table, the number of rows and how long it took. A small shop database (customers, products, orders and order items) is ready to query, or start from an empty database and create your own tables.
It is also a quick CSV to SQLite converter: import a CSV or JSON file and it becomes a typed table you can query with SQL, join with other tables and download as a .sqlite file. You can open existing .sqlite and .db files too, to look inside an app’s database without installing anything.
Nothing leaves your device. The SQLite engine is downloaded once as WebAssembly and the database lives only in this tab’s memory.
How to use the Online SQL Compiler (SQLite Playground)
- Press Run (or Ctrl + Enter, ⌘ + Enter on a Mac). The first run loads SQLite, about 0.7 MB; later runs are instant.
- Edit the SQL or pick one of the Examples — joins, GROUP BY, strftime dates, window functions, JSON functions and data changes. Select part of the text to run only that part.
- Click a table name under Tables to see its first 100 rows; the column names, types and primary keys are listed under each table.
- Use Import CSV / JSON / .sqlite or drop a file on the Tables panel. CSV and JSON files become new tables; a SQLite file replaces the current database.
- Press Download .sqlite to save the whole database, or Result CSV to save the last result table.
Online SQL Compiler (SQLite Playground) features
Real SQLite 3.49
Not an emulator: sql.js compiles the official SQLite source to WebAssembly, so CTEs, window functions, UPSERT, JSON functions, generated columns and STRICT tables behave exactly as in SQLite.
Several statements at once
Run a whole script. Each SELECT gets its own result table; CREATE, INSERT, UPDATE and DELETE report how many rows changed and how long they took.
CSV and JSON to SQLite
Files are parsed by the same RFC 4180 engine as the CSV to SQL converter: quoted fields and line breaks inside quotes work, empty cells become NULL and columns get INTEGER, REAL or TEXT types.
Open and save .sqlite files
Inspect a database from an app or a project, change it with SQL and download the result.
Safe with big or slow queries
Results show the first 100 to 10,000 rows while counting them all, and the engine runs in a background worker, so Stop ends a runaway query without freezing the page.
Timings
Each statement shows its execution time, useful for comparing a query with and without an index.
The sample database
It is small enough to check answers by hand and rich enough to practise joins, grouping, date functions and window functions. Press Sample database to reset it at any time.
| Table | Rows | Columns |
|---|---|---|
| customers | 8 | id, name, city, country, joined |
| products | 8 | id, name, category, price |
| orders | 12 | id, customer_id → customers, ordered_at, status |
| order_items | 18 | order_id → orders, product_id → products, qty, unit_price |
SQLite differences to keep in mind
- Flexible types: SQLite stores a value’s own type and treats the declared column type as a preference (type affinity). Add
STRICTto a CREATE TABLE to enforce types. - Dates are text or numbers. Use ISO 8601 strings and the
date(),datetime()andstrftime()functions. - Foreign keys are off by default. Run
PRAGMA foreign_keys = ON;to enforce them. - No stored procedures, users or permissions — SQLite is an embedded database. For MySQL, PostgreSQL or SQL Server syntax, check dialect differences with the SQL validator.
- Downloading closes and reopens the database, so TEMP tables and an open transaction are not kept: COMMIT first.
Limits
The database lives in memory, so practical sizes depend on your device — a few hundred MB works on most laptops; phones have less room. Stop restarts the engine with the database as it was last loaded (the sample, an opened file or an empty one), so download your work regularly. Format long queries with the SQL formatter, or build them visually with the SQL query builder.
Online SQL Compiler (SQLite Playground) FAQ
Is this a real online SQL compiler or a simulation?
It is real SQLite 3.49.1, compiled to WebAssembly by the open-source sql.js project (MIT licence) and run in your browser. Queries return exactly what SQLite would return on a server or a phone.
How do I convert CSV to SQLite?
Press Import CSV / JSON / .sqlite and choose the CSV file. It becomes a table named after the file, with types detected from the data. Then press Download .sqlite to save the database file.
Can I run MySQL or PostgreSQL queries here?
Standard SQL — SELECT, joins, GROUP BY, subqueries, CTEs, window functions — runs as is. Database-specific syntax such as MySQL’s AUTO_INCREMENT keyword or PostgreSQL’s SERIAL type does not; use INTEGER PRIMARY KEY for auto-numbered ids in SQLite.
Is my data uploaded?
No. The database, your queries and imported files stay in your browser. Only the SQLite engine itself is downloaded, from a public CDN.
Why did my changes disappear after Stop?
Stopping ends the background engine to break a runaway query, then reloads the database as it was last loaded. Download .sqlite after important changes.
How many rows can it show?
It counts every row but displays the first 100, 1,000 or 10,000, as you choose. Add LIMIT and OFFSET to page through larger results.