Online SQL Playground
A free online SQL compiler that needs no sign-up and no server: a full SQLite engine runs inside your browser via WebAssembly, preloaded with a realistic sample database (departments, employees, customers, products, orders, order items). Write any query, press Ctrl+Enter, and see the result grid instantly. Ten graded practice exercises cover filtering, joins, anti joins, aggregation, subqueries, self joins, date grouping and window functions; the checker compares your result rows against a reference solution. You can also create your own tables and insert data. Nothing you type leaves your machine.
Do more than online sql playground — meet Chat2DB
Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.
How to use
- Wait a second for the engine to load, then type a query in the editor or pick a practice exercise from the dropdown to load its task as a comment.
- Press Run (or Ctrl+Enter / Cmd+Enter) to execute. The last result set is shown as a grid; DDL and DML report the number of rows modified and update the schema panel.
- For exercises, press Check answer to compare your rows with the reference solution, or Show solution to study a working query. Reset database restores the sample data at any time.
Frequently asked questions
Which SQL dialect does this online SQL playground use?
SQLite 3, compiled to WebAssembly with sql.js. SQLite supports the SQL you need for practice: JOINs (including FULL OUTER JOIN in recent versions), GROUP BY and HAVING, subqueries, common table expressions, window functions such as ROW_NUMBER, RANK, LAG and running SUM, CASE expressions, and date functions via strftime. Dialect-specific features like PostgreSQL's ILIKE or MySQL's DATE_FORMAT are not available; the exercises are written in portable SQL so the same solutions work with small changes on PostgreSQL, MySQL and SQL Server.
Is my SQL or data uploaded anywhere?
No. The database engine is downloaded once from a public CDN as a WebAssembly file and then runs entirely in your browser tab. Queries, tables you create and data you insert stay in memory on your machine and disappear when you reload the page. If you need to keep work, copy the SQL out of the editor. To run the same queries against a real PostgreSQL, MySQL or SQL Server database, use Chat2DB: download it at https://chat2db.ai/download or open the web version at https://app.chat2db.ai.
How does the exercise checker decide whether my answer is correct?
It runs your query and the reference solution against the same in-memory database and compares the result rows as a multiset: the number of columns and the number of rows must match, and every row must have identical values (numbers are rounded to three decimals, NULL must be NULL). Column names and aliases are ignored, and row order is not enforced, so an unordered result can pass even when the task asks for a sort; read the task text and add ORDER BY when it is required.
