SQL Playground: SQLite and PostgreSQL
Write queries in tabs, run them on SQLite (sql.js) or PostgreSQL (PGlite) compiled to WebAssembly, see plans with EXPLAIN and export results.
S'executa al teu navegador. Els fitxers mai no surten del dispositiu. Mira com comprovar-ho
…
Com es fa
- 1Pick an engine
Choose SQLite or PostgreSQL and press Start; read the download note first.
- 2Write a query
Use a tab or + Tab and type SQL; several statements are fine.
- 3Run it
Press Run or Ctrl+Enter; select text to run only part.
- 4Explain it
Press Explain plan to see how the engine executes the query.
- 5Browse the schema
Open the Schema tab and tap a table to add a SELECT.
- 6Export
Export the last result as CSV, JSON or XLSX, or download the SQLite database.
Sobre aquesta eina
Most online SQL sandboxes send your query to a server. This playground runs the database engines themselves inside your browser tab. SQLite comes from sql.js, the official SQLite C code compiled to WebAssembly, and PostgreSQL from PGlite, a WebAssembly build of real Postgres. Both start with the same small shop database of customers, products, orders and order items, so you can practise joins, grouping and window functions at once. Queries live in saved tabs, every statement shows its own result table and timing, and Explain plan shows how the engine intends to run your query.
Who it is for
Learners practising SQL, developers testing a query before it goes into code, interview candidates, and anyone who wants to inspect a .sqlite file without installing software.
Engines and downloads
The engines are loaded from cdn.jsdelivr.net at pinned versions only after you press Start: about 0.7 MB for SQLite and about 3 MB compressed for PostgreSQL. After the first start the page remembers your choice and the browser caches the files. Your queries and data never leave the device.
Running SQL
Write several statements separated by semicolons; each one gets its own result card with row count and milliseconds, and execution stops at the first error with the database message. Select part of the text to run only that. Ctrl+Enter runs, Ctrl+Shift+Enter explains.
Query plans
For SQLite, Explain plan prefixes EXPLAIN QUERY PLAN and shows steps such as SCAN orders or SEARCH customers USING INTEGER PRIMARY KEY. For PostgreSQL it runs EXPLAIN (ANALYZE) and shows the plan with real timings: Hash Join, Seq Scan, Index Scan and their costs. Compare plans before and after adding an index to see whether it is used.
Schema and files
The Schema tab lists every table with its columns and types; tap a table name to add a SELECT for it. With SQLite you can open an existing .sqlite or .db file and download the current database, including your changes.
Exporting results
The last result exports as CSV, JSON, XLSX, INSERT statements or tab-separated text that pastes straight into a spreadsheet.
Worked example
The Revenue tab joins shipped orders to their items and prices. On the sample data Lukas Becker comes first with 2 orders and revenue 168.00 (a 129.00 grinder plus four green teas at 9.75), Amina Rahman follows with 2 orders and 79.90, and James Smith has 1 order worth 43.40. The second query shows coffee leading with 9 units, then gear with 7 and tea with 6. Changing a status to shipped and running again updates the totals.
Limits
The database lives in memory: reloading the page restores the sample data, so download the SQLite file if you need your changes. PostgreSQL extensions beyond the built-in set, multiple connections, users and roles are not available, and very large files are limited by your device memory. This is a practice and analysis tool, not a production database.
Exemple resolt
Revenue per customer on the sample data: Lukas Becker 168.00, Amina Rahman 79.90, James Smith 43.40.
En resum
- Categoria: Desenvolupament i dades
- S'executa al navegador, sense registre, sense pujar res.
- La informació que introdueixes es queda al dispositiu.
- Disponible en anglès.
- Contingut revisat per última vegada:
- Font oficial: SQLite 3 via sql.js (WebAssembly) and PostgreSQL via PGlite (ElectricSQL), with EXPLAIN QUERY PLAN and EXPLAIN ANALYZE
Preguntes freqüents
Is this a real PostgreSQL?
Yes, PGlite is PostgreSQL compiled to WebAssembly, running in your tab as a single-user database.
Can I open my own SQLite file?
Yes. Start SQLite, press Open .sqlite and pick the file; it is read locally.
Are my queries uploaded?
No. The engines run in your browser; only the engine files are downloaded from the CDN.
Why did my data disappear after reload?
The database is held in memory. Queries are saved, data is not; download the .sqlite file to keep it.
How do I see if an index is used?
Press Explain plan. SQLite shows SEARCH … USING INDEX and PostgreSQL shows Index Scan when it is.
Which export formats are there?
CSV, JSON, XLSX, INSERT statements and spreadsheet-ready tab-separated text.
