Utvikling · verktøy

SQLite-lekeplass

Opprett en tabell eller lim inn en spørring. Dataene blir i denne fanen og slettes når du tilbakestiller.

Kjøres i nettleseren. Ingen opplasting.

Values are processed locally in this browser.

Result

—

Om verktøyet

SQLite-lekeplass sem complicação.

Verktøyet bruker en lokal SQLite WebAssembly-motor. Store spørringer trenger mer minne; ingenting lastes opp eller lagres eksternt.

Veiledning

Slik bruker du SQLite-lekeplass

The SQLite Playground runs real SQLite, compiled to WebAssembly, inside a browser tab. You type SQL, press the run button and see the rows in a table. The database lives only in memory for that tab, so tables you create disappear when you press Reset or leave the page. It suits learning and trying queries, not storing data.

Slik gjør du

  1. Type or paste SQL into the query box. It starts with SELECT 1 AS ready; and accepts up to 20,000 characters.
  2. Press the run button, which is labelled Calculate on the page. Results show as a table, and as tab-separated text in the Result box.
  3. Create a table and add rows in one go, ending with a SELECT so you can see the data. Later queries in the same tab can use that table.
  4. Press Reset to throw the database away and start with an empty one.

Eksempler

The default query

Du skriver inn
SQL
SELECT 1 AS ready;
Du får
Kolonner
species
Rader
1

A SELECT with no table returns one row. The status line says the result is ready and was computed locally. This was run in the real page in a browser.

Kjørt med verktøyets egen kode.

Create, fill and group in one script

Du skriver inn
SQL
CREATE TABLE pets(id INTEGER PRIMARY KEY, name TEXT, species TEXT, age INTEGER); INSERT INTO pets(name,species,age) VALUES ('Mia','cat',4),('Rex','dog',7),('Tom','cat',2); SELECT species, COUNT(*) AS n, AVG(age) AS avg_age FROM pets GROUP BY species ORDER BY species;
Du får
Kolonner
species; n; avg_age
Rader
cat; 2; 3; dog; 1; 7

Cats are aged 4 and 2, so the average is 3. The table pets stays in memory, so a later SELECT * FROM pets in the same tab returns all three rows until you press Reset.

Kjørt med verktøyets egen kode.

A typo and a missing table

Du skriver inn
SQL
SELEC 1;
Du får
Status
SQLITE_ERROR: sqlite3 result code 1: near "SELEC": syntax error

SQLite's own error message is shown in the status line and the result table is emptied. A query on a table that does not exist gives a similar message, such as no such table: pets after a Reset.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Practise SELECT, JOIN and GROUP BY without installing a database.
  • Test a query idea quickly before putting it into an app.
  • Teach SQL basics in a class with nothing to set up.
  • Check how a SQLite function behaves, for example sqlite_version().

Begrensninger

  • If a script holds several statements that return rows, only the first result set is shown. The later ones run but are not displayed.
  • Results are cut off at 500 rows. A longer result gives the message to add a LIMIT, and no rows are shown.
  • Statements like INSERT or UPDATE show an empty result with the same ready message, with no count of changed rows.
  • Data is kept only in memory in this tab and is not saved. Nothing is shared between visits, and the Clear and Copy result buttons gave no visible response in my test.

Tips

  • Put the SELECT you want to see last, and run one result-producing statement per run, since only the first set is shown.
  • Add LIMIT 50 to exploratory queries on big generated data to stay under the 500-row cap.
  • Keep your CREATE TABLE and INSERT statements in your own notes, because Reset and closing the tab remove them.

Kilder

Vanlige spørsmål

Sobre SQLite-lekeplass.

Which SQLite version does it run?

It uses the sqlite-wasm package bundled with the site. In my test of the same package, sqlite_version() returned 3.53.4. You can run SELECT sqlite_version(); in the tool to see the version it uses.

Is my data uploaded or saved?

No. The database is created in memory in a web worker inside your tab. The page says nothing is uploaded or saved remotely, and the data is gone when you reset or close the tab.

Why does my INSERT show an empty result?

A statement that returns no rows produces an empty table and the usual ready message. The statement did run, so follow it with a SELECT in the same script to see the effect.

Why do I only see one result from several SELECTs?

When a script has more than one statement that returns rows, the tool displays only the first result set. Run the statements one at a time to see each one.

What is the row limit?

The preview shows at most 500 rows, and a query that returns more shows an error asking you to add LIMIT. The query text itself can be up to 20,000 characters.

Can I load a database file?

No file loading appears on the page. You can only type SQL and build tables in the empty in-memory database, then use Reset to start fresh.

Can it replace a real database tool?

No. It is for learning and quick tests. Nothing persists, results are capped, and it is no substitute for a proper database setup with backups for real data.

Hvordan bruker du SQLite-lekeplass?

Opprett en tabell eller lim inn en spørring. Dataene blir i denne fanen og slettes når du tilbakestiller.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.