Get Started Free
Live in your browser

Turso Playground

Try VisuaLeaf's SQL editor, table data grid, table management and schema designer on Turso, the SQLite-compatible database written in Rust, compiled to WebAssembly and running right here in your browser. No install, no sign-up, and nothing you type leaves your browser.

Preparing for a SQL interview?30 SQL interview questions on a store like this one. Write the query, get it checked instantly, hidden test cases included. Practice now

More playgrounds: MongoDB · DuckDB · PostgreSQL

×

SQL editor

Starting Turso in your browser…

Embed

Use these tools outside the playground

The playground is built from web components. A blog post, a SQL course or your product docs can show a live SQLite-compatible editor, table or schema diagram with one script tag. The snippet follows the tool and size you picked above.

  1. Load the script from visualeaf.com

    One script tag from https://visualeaf.com/playground-turso/widget/latest/main.js. We host everything and keep it up to date. Nothing to install or build.

  2. Bring your data

    init runs a SQL script first: CREATE TABLE, INSERT, views. data loads rows from JSON, a table per key. Both can come from a URL (init-url, data-url), which must allow cross-origin requests (CORS).

  3. Place the element

    Put a <visualeaf-sql>, <visualeaf-table>, <visualeaf-table-manager> or <visualeaf-schema> where it should appear, and size it with CSS like any block. Each reader gets their own in-memory database.

Your snippet ·

Rows from JSON

data takes {"table": [rows…]}: each key becomes a table, its column types read from the values. data-url fetches the same.

<visualeaf-sql
  data='{"sales": [
    {"region": "EU", "amount": 120.5},
    {"region": "US", "amount": 80}]}'
  script="SELECT region, sum(amount)
    FROM sales GROUP BY region"></visualeaf-sql>

A setup script

init runs SQL once before the reader sees the widget. If a statement fails, the widget shows it with Turso's message.

<visualeaf-table table="products"
  init="
    CREATE TABLE products (
      id INTEGER PRIMARY KEY,
      name TEXT NOT NULL,
      price REAL);
    INSERT INTO products (name, price) VALUES
      ('Pen', 2.50), ('Notebook', 7);
  "></visualeaf-table>

One database, many widgets

Widgets with the same shared-db share a database, like on this page. Create a table in the editor, browse it further down.

<visualeaf-sql shared-db="store"
  init-url="https://visualeaf.com/playground-turso/widget/latest/samples/store-init.sql"></visualeaf-sql>

<!-- …the text of your post… -->

<visualeaf-schema shared-db="store"></visualeaf-schema>

Reference

Attributes

Attributes are read when the element starts, so set them before adding it to the page.

AttributeWhat it does
databaseA SQLite-compatible database is one file with one catalog, main: the widget always works in it. Use name for what the breadcrumb shows.
dataRows to load first, as JSON: {"table": [{…}, …]}, a table per key. The column types are read from the values.
data-urlThe same, fetched from a URL.
initA SQL script run once at start, after data. A failure stops the widget with the statement and Turso's message.
init-urlThe same, fetched from a .sql file.
shared-dbWidgets on the page with the same value share one database. The first to start opens it with its attributes, and what one changes the others see.
nameThe connection's name in the breadcrumb.
themedark or light. Without it: the reader's choice from the ☀ / ☾ toggle, else dark.
resizablefalse hides the handle readers drag to make the widget taller.
min-heightThe smallest height that handle allows, in px (default 360).
viewThe screen to start on (editor, table, manage, schema), when one element should start on another screen.

Like it? Use it on your own databases.

The desktop app has the same SQL editor, table editor, table management and schema designer, plus charts, explain plans, data compare and more, for SQLite, PostgreSQL, MySQL, DuckDB, SQL Server, MongoDB and more.