About this SQL playground
This is an online SQL editor that runs your queries on SQLite, the small SQL database built into phones, browsers and countless apps. Write SQL in the editor, press Run, and each query's result appears next to it as a table, along with any error and how long it took.
Every run gets a fresh, empty database in memory, so a script creates its tables, fills them and queries them in one go. The statements run from top to bottom and stop at the first error, which names the line it is on. It is free, with nothing to install and no account needed.
What you can run
- SQLite 3.37, running one file per run, saved as
main.sql. - Standard library only. All of SQLite's built-in functions are there: text, maths, date and time, aggregates such as COUNT and AVG, JSON functions such as json_extract, and window functions such as ROW_NUMBER(). There is no package installer, and programs have no network access.
- Limits: 10 seconds and 256 MB of memory per run. Output past 64 KB is cut off, code can be up to 64 KB and input up to 16 KB.
- Fair use: 5 runs a minute and 50 a day without an account, 10 a minute when you are signed in.
Frequently asked questions
Is this online SQL compiler free?
Yes. There is no sign-up and no limit on how much you can write. Signed-out visitors get a quick, usually invisible bot check when they press Run, and a fair-use cap of 5 runs a minute and 50 a day. Signing in raises it to 10 runs a minute.
Which database does it use?
SQLite 3.37. Each run starts with a new, empty database held in memory and thrown away when the run ends, so tables from your last run are gone. Put your CREATE TABLE and INSERT statements at the top of the script, above the queries.
Will MySQL or PostgreSQL queries work?
Most everyday SQL does: SELECT, WHERE, JOIN, GROUP BY, subqueries, WITH (common table expressions) and window functions. SQLite differs in places, though: this version has no RIGHT or FULL OUTER JOIN, there are no stored procedures, ALTER TABLE is limited, and column types are loose. Queries written for another database may need small changes.
Why does my script print nothing?
Only statements that return rows print anything. CREATE, INSERT, UPDATE and DELETE run silently, so add a SELECT afterwards to see what they did. Each SELECT prints its own table.
Why did my query stop with a time-out?
Each run gets 10 seconds and 256 MB of memory. A program that goes past either is stopped. The usual cause is a recursive WITH query that has no condition to end it, or a join that makes far more rows than you meant.
Is my code saved or shared?
Your code is kept in your own browser so it is still there next time, and nowhere else. When you press Run it is sent to our code runner, run once in a sandbox, and thrown away. We do not store it or show it to anyone.