DEV Community

Michael Lip
Michael Lip

Posted on • Originally published at zovo.one

Learning SQL Without Installing a Database: The Browser SQL Playground

The biggest friction in learning SQL is setup. Install PostgreSQL or MySQL, configure authentication, create a database, import sample data. For someone who just wants to try a SELECT statement, that's an hour of prerequisite work.

A browser SQL playground eliminates all of it. Open the page, write a query, see results. No installation, no configuration, no database server.

How it works: SQLite in the browser

sql.js is a JavaScript port of SQLite compiled from C to WebAssembly using Emscripten. It runs a full SQLite database engine entirely in the browser. No server communication. No data leaving your machine. A complete relational database in a WebAssembly binary.

const SQL = await initSqlJs();
const db = new SQL.Database();
db.run("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)");
db.run("INSERT INTO users VALUES (1, 'Alice', 'alice@example.com')");
const results = db.exec("SELECT * FROM users WHERE name = 'Alice'");
Enter fullscreen mode Exit fullscreen mode

Performance is surprisingly good. SQLite in WASM handles databases up to several hundred megabytes and queries with millions of rows. For learning purposes, it's indistinguishable from a server-based database.

What you can practice

SQLite supports standard SQL: SELECT, INSERT, UPDATE, DELETE, JOINs (INNER, LEFT, RIGHT, CROSS), subqueries, CTEs (WITH clauses), window functions, aggregate functions, GROUP BY, HAVING, ORDER BY, LIMIT/OFFSET, CREATE TABLE, ALTER TABLE, and indexes.

What SQLite doesn't support that other databases do: stored procedures, RIGHT JOIN (in older versions), FULL OUTER JOIN (workaround exists), and some specific data types. For learning SQL fundamentals, these gaps rarely matter.

Pre-loaded sample data

The most useful SQL playgrounds come with sample data already loaded. A classic dataset includes:

  • Employees table: id, name, department, salary, hire_date
  • Departments table: id, name, budget, manager_id
  • Orders table: id, customer_id, product_id, quantity, date
  • Products table: id, name, price, category

With these four tables, you can practice:

  • Basic SELECT and WHERE filtering
  • JOINs across multiple tables
  • Aggregate queries (SUM, AVG, COUNT, MAX, MIN)
  • GROUP BY with HAVING
  • Subqueries and correlated subqueries
  • Window functions (ROW_NUMBER, RANK, LAG, LEAD)

Why SQL playgrounds matter for professionals too

I use a SQL playground when I need to prototype a complex query before running it against a production database. Write the query against sample data, verify the logic, then adapt it to the real schema. It's faster than connecting to a staging database and safer than experimenting on production.

It's also useful for technical interviews. Interviewer gives you a schema and asks you to write a query. Having practiced in a playground where you get instant feedback beats studying SQL syntax from a textbook.

I built a SQL playground at zovo.one/free-tools/sql-playground with pre-loaded sample data, syntax highlighting, query history, and result table display. Write SQL, see results instantly, no setup required.

I'm Michael Lip. I build free developer tools at zovo.one. 500+ tools, all private, all free.

Top comments (0)