SQLite playground: run SQLite online
SQLite compiled to WebAssembly, running right in your browser with sample databases loaded. Write a query, press Run, see the result. Below: how SQLite differs, and five queries that only work in SQLite.
SQLite 3.54.1, read from the engine itself when this page was built.
Each run starts from a fresh copy of the sample data. To try your own tables, put CREATE TABLE, INSERT and your SELECT in one run.
What works here
- ✓CTEs, including WITH RECURSIVE
- ✓Window functions, FILTER (WHERE …) and RIGHT and FULL OUTER JOIN
- ✓Date functions: date, strftime, julianday
- ✓JSON functions (json_object, json_extract)
- ✓UPSERT (ON CONFLICT … DO UPDATE) and RETURNING
- ✓CREATE TABLE, INSERT, UPDATE, DELETE, views and indexes
How SQLite is different
- –Typing is flexible: a column's type is a hint, not a rule
- –There is no DATE type: dates are ISO text, and date functions read the text
- –Some loose old behaviour is still on (double-quoted text, bare columns in GROUP BY)
- –Every run starts from a fresh copy of the data
Five queries only SQLite runs
Each one was run on both engines when this page was built: it works in SQLite and fails in PostgreSQL. More side by side in PostgreSQL vs SQLite.
Sign-ups per month with strftime
strftime formats ISO date text; '%Y-%m' gives the month. PostgreSQL has no strftime: it uses to_char and date_trunc.
SELECT strftime('%Y-%m', signed_up_on) AS month, COUNT(*) AS signups FROM users GROUP BY month ORDER BY month;Result: 3 rows
month signups 2026-01 80 2026-02 100 2026-03 120 Data: StreamlyFlexible typing: what is really stored
typeof() shows the storage class of each value. A BOOLEAN is stored as an integer and a DATE as text. PostgreSQL has no typeof (its closest is pg_typeof).
SELECT name, typeof(age) AS age_type, typeof(adopted) AS adopted_type, typeof(arrived_on) AS date_type FROM pets LIMIT 3;Result: 3 rows
name age_type adopted_type date_type Biscuit integer integer text Mochi integer integer text Pickles integer integer text Data: Paws & Whiskers ShelterBare columns in GROUP BY
SQLite lets you select a column that isn't grouped. With MAX() it comes from the row with the maximum. PostgreSQL rejects this query.
SELECT category, name, MAX(price) AS top_price FROM menu_items GROUP BY category ORDER BY category;Result: 4 rows
category name top_price dessert Tiramisu 6.5 drink Lemon Soda 3 pizza BBQ Meteor 15.5 side Wings 8.5 Data: Rocket PizzaThe double-quoted text fallback
"cat" means a column named cat, but when no such column exists SQLite quietly treats it as text. PostgreSQL reports column "cat" does not exist. Use 'single quotes' for text everywhere.
SELECT name, species FROM pets WHERE species = "cat";Result: 7 rows
name species Mochi cat Luna cat Pepper cat Tofu cat Socks cat Olive cat Pumpkin cat Data: Paws & Whiskers ShelterDays between dates with julianday
julianday turns a date into a day number, so subtracting two gives days. In PostgreSQL you subtract the dates directly.
SELECT name, arrived_on, CAST(julianday('2026-07-01') - julianday(arrived_on) AS INTEGER) AS days_waiting FROM pets WHERE adopted = false ORDER BY days_waiting DESC LIMIT 5;Result: 5 rows
name arrived_on days_waiting Tofu 2025-04-04 453 Gizmo 2025-05-23 404 Bruno 2025-06-30 366 Rocket 2025-07-09 357 Socks 2025-08-17 318 Data: Paws & Whiskers Shelter
SQLite questions
Is this a real SQLite?+
Yes. It's SQLite compiled to WebAssembly (sql.js), running in your browser tab. The version is printed above. Nothing is sent to a server.
Does SQLite support RIGHT JOIN and FULL OUTER JOIN?+
Yes, since SQLite 3.39.0 (2022), so both work here. Older SQLite builds, still found in some tools, only have LEFT JOIN; there you swap the tables or combine two LEFT JOINs with UNION.
Does SQLite have a DATE type?+
No. Dates are stored as text such as '2026-03-01' (or as numbers), and the date functions date(), strftime() and julianday() read that text. ISO text sorts and compares correctly, which is why it's the usual choice.
Why does SQLite accept a GROUP BY that PostgreSQL rejects?+
SQLite allows bare columns: columns in SELECT that are neither grouped nor aggregated. With a single MAX or MIN they come from that row; otherwise from an arbitrary row. PostgreSQL refuses rather than guess, so write portable SQL with a window function.
Is SQLite strict about types?+
Not by default: a column declared INTEGER happily stores text. Tables created WITH STRICT reject the wrong type, and they work here too.
SQL guides
Joins, window functions, CTEs and more, with runnable examples.
SQL errors explained
What common PostgreSQL and SQLite errors mean and how to fix them.
Learn SQL daily
Five-minute lessons with instant feedback and a streak. Free to start.