SQL Playground
Run SQL queries directly in your browser using SQLite compiled to WebAssembly. Comes with a pre-loaded sample database (employees & departments). Supports CREATE, INSERT, SELECT, JOINs, aggregates, multi-statement queries, and more. Your data never leaves your browser.
Online SQL Query Editor & Sandbox
This SQL Playground runs a full SQLite database engine in your browser using WebAssembly. There is no server, no signup, and no data leaves your machine. Write SQL queries, create tables, insert data, and see results instantly. The pre-loaded sample database includes employees and departments tables so you can start practicing SQL immediately.
Features
- Full SQLite engine running in WebAssembly — CREATE TABLE, INSERT, SELECT, UPDATE, DELETE, and more
- JOINs: INNER JOIN, LEFT JOIN, CROSS JOIN with full ON/USING clause support
- Aggregate functions: COUNT, SUM, AVG, MIN, MAX with GROUP BY and HAVING
- Advanced SQL: subqueries, CTEs (WITH clause), CASE expressions, window functions, UNION
- Multi-statement support: run multiple SQL statements separated by semicolons in a single execution
- Pre-loaded sample database with employees and departments tables (15 employees, 5 departments)
- Export results as CSV for use in spreadsheets or other tools
- Execution time measurement to benchmark your queries
- 12 built-in example queries covering SELECT, JOINs, aggregates, subqueries, CTEs, and more
- Query history saved to localStorage for easy recall
- Keyboard shortcuts: Ctrl+Enter run, Ctrl+Shift+C copy, Ctrl+L clear
- 100% client-side — your queries and data never leave your browser
How It Works
When you load this page, the SQLite database engine (compiled to WebAssembly via sql.js) is downloaded and initialized in your browser. A sample database with employees and departments is created in memory. When you click Run Query, your SQL is parsed and executed entirely within the browser's WebAssembly sandbox. Results are rendered as interactive tables. The database persists in memory as long as the page is open — you can create tables, modify data, and run complex queries across multiple executions.
Use Cases
- Learning SQL — practice SELECT statements, JOINs, and aggregates with a real database
- Interview preparation — rehearse SQL coding challenges with instant feedback
- Quick prototyping — test table schemas and query logic before deploying to production
- Data analysis — create tables, insert data, and run analytical queries without setting up a database
- Teaching — demonstrate SQL concepts with live, interactive examples