How to run SQL online
- Pick an engine: SQLite or PostgreSQL. Both run inside your browser, so your data never leaves your computer.
- Start from a sample database (Employees or Shop) or an empty one, and look at its tables on the Schema tab.
- Write your queries and press Run SQL or Ctrl + Enter. Each statement gets its own result table; select part of the code to run only that.
- Export any result as CSV, or press Share to copy a link with your queries.
SQLite or PostgreSQL?
| SQLite | PostgreSQL | |
|---|---|---|
| Best for | Learning SQL, quick tests, interviews | Practising the SQL of a real server: window functions, JSON, strict types |
| Start time | Instant | A few seconds on the first run (it downloads about 3 MB) |
| Types | Flexible: any value fits any column | Strict: INTEGER, NUMERIC, DATE, JSONB and more |
| Runs on | Your browser, with no account and no server | |
MySQL syntax is close to both for everyday queries (SELECT, JOIN, GROUP BY, subqueries). Features only MySQL has, such as AUTO_INCREMENT or backtick quotes, need small changes.
SQL queries to try
- Filter and sort:
SELECT name, salary FROM employees WHERE salary > 6000 ORDER BY salary DESC; - Group and count:
SELECT department_id, COUNT(*) FROM employees GROUP BY department_id; - Join two tables:
SELECT e.name, d.name FROM employees e JOIN departments d ON d.id = e.department_id; - Window function:
SELECT name, salary, RANK() OVER (ORDER BY salary DESC) FROM employees; - Your own table:
CREATE TABLE,INSERT,UPDATEandDELETEall work; Reset database brings the sample back.
Frequently asked questions
Which SQL databases can I use?
SQLite and PostgreSQL. Both run in your browser, so there is nothing to install and no account to create. SQLite starts instantly; PostgreSQL downloads about 3 MB on its first run.
Is my data sent to a server?
No. The database lives in your browser tab. Queries, imported files and results stay on your computer, and closing the tab removes the database.
Can I run several queries at once?
Yes. Write as many statements as you like, separated by semicolons. Each one gets its own result table, and selecting part of the code runs only that part.
Can I import my own data?
Yes. Import a .sql file to run its statements, or a .csv file to load it into a new table named after the file.
Does it work for MySQL queries?
Everyday MySQL queries such as SELECT, JOIN, GROUP BY and subqueries run the same way. MySQL-only syntax, such as AUTO_INCREMENT or backtick quotes, needs small changes.
Is it free?
Yes. The SQL editor, the sample databases and the CSV export are free and need no account.
Related tools
- AI Code Checker: Explain and Fix Code OnlinePaste your code and let AI explain it in plain language or find and fix bugs. Python, C++, Java, JavaScript and 9 more languages. Free account.
- AI Code Generator: Python, C++, Java and MoreFree AI code generator. Describe what you need, get a complete runnable program with an explanation, and run it in the online editor. 13 languages.
- HTML Online Editor: Write HTML, CSS and JS with Live PreviewFree HTML online editor with live preview: write HTML, CSS and JavaScript, see the page update as you type, check the console and phone view, share or download.