elefcode
← All guides

Dev Basics · 4 min read

Practising SQL in the Browser: SQLite vs PostgreSQL

You no longer need to install a database server to learn or test SQL. Both SQLite and PostgreSQL can now run entirely inside a browser tab, compiled to WebAssembly — your data never leaves your machine.

Try it yourself with the related tool.

Open the SQL playground →

Advertisement

How it works

WebAssembly lets C programs like SQLite and PostgreSQL run in the browser at near-native speed. The database lives in memory (or browser storage), so you can create tables, insert rows, and run queries instantly, then reset and start over with nothing to clean up.

SQLite vs PostgreSQL differences

SQLite is loosely typed: a column declared as INTEGER will happily store text unless the table is STRICT. PostgreSQL enforces types strictly and has richer features — SERIAL and identity columns, JSONB, arrays, window functions, and RETURNING. Date handling differs too: SQLite stores dates as text or numbers and uses functions like date(), while PostgreSQL has real timestamp types.

Most beginner SQL — SELECT, WHERE, JOIN, GROUP BY — is identical in both.

A practice plan

Start with one table and SELECT with WHERE, ORDER BY, and LIMIT. Add a second table and practise each JOIN type. Then aggregate with GROUP BY and HAVING, and finally try subqueries and CTEs (WITH ...). Write the question in plain English first, then translate it to SQL.

Use EXPLAIN

Once queries work, prefix them with EXPLAIN (or EXPLAIN QUERY PLAN in SQLite) to see how the database runs them. Adding an index and watching a full table scan turn into an index lookup is the fastest way to understand indexing.

Quick reference

Related guides