TechDojoLite

Subjects / SQL playground

The query dojo

Three tables.
A world of connections.

Become the analyst at Dojo Insurance. Explore the records, connect customers to their policies and trace every claim.

Fictional records · runs in your browser
Changes and practice progress last for this visit only. No account required.

Try a query

The SQL desk

query.sqlCtrl / ⌘ + Enter to run

Use a single statement. Text goes in single quotes. Table and column names are not case sensitive.

Query result

Ready when you are
Ask the data a question.

Write a query above, then run it to see the result here.

Recent queries 0

    A little help at your desk

    SQL pocket guide

    Choose & filter

    SELECT name, city
    FROM customers
    WHERE city = 'London'
    ORDER BY name;

    WHERE filters rows. Use AND / OR and parentheses to combine conditions.

    Connect two tables

    SELECT c.name, p.policy_type
    FROM customers c
    JOIN policies p
      ON c.customer_id = p.customer_id;

    JOIN keeps matching rows. LEFT JOIN also keeps unmatched rows from the first table.

    Summarise

    SELECT status, COUNT(*) AS total
    FROM claims
    GROUP BY status
    HAVING COUNT(*) > 2;

    GROUP BY gathers rows. HAVING filters groups. COUNT(column) ignores NULL; COUNT(*) counts rows.

    What this teaching simulator supports

    SELECT, DISTINCT, table and column aliases, INNER JOIN, LEFT JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and OFFSET. Conditions include =, !=, <>, <, >, <=, >=, AND, OR, NOT, IS NULL, IS NOT NULL, IN, BETWEEN and LIKE (% and _). Arithmetic supports +, −, *, / and %. Aggregates: COUNT, SUM, AVG, MIN and MAX. Other functions: ROUND, LOWER, UPPER, LENGTH, COALESCE and ABS.

    Sandbox also supports INSERT INTO with a column list and VALUES, UPDATE ... SET, and DELETE FROM. Primary keys must be unique; foreign keys must reference existing rows. All provided columns are required. Failed changes leave all tables unchanged.

    This is a small JavaScript emulator, not a full SQL dialect. It does not support subqueries, UNION, RIGHT/FULL/CROSS JOIN, CREATE/DROP/ALTER, date functions, transactions or quoted identifiers. Dates are text in YYYY-MM-DD format. Text comparisons are case sensitive; LIKE ignores case. Use a decimal point for decimal numbers. Results display up to 200 rows, and each table holds up to 200 records. Queries have a work limit to keep the lab responsive.