DevBolt
Processed in your browser. Your data never leaves your device.

SQL JOIN Practice — Interactive Examples

Master SQL JOINs with hands-on practice in a real database. This interactive playground lets you write and run JOIN queries against sample data instantly — no setup, no server, no signup required.

Samples:

Loading SQLite engine…

SQLite dialect • Multiple statements supported508 chars
Run a query to see results

SQLite Quick Reference

Data Definition

CREATE TABLE t (
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  val REAL DEFAULT 0
);
ALTER TABLE t ADD col TEXT;
DROP TABLE IF EXISTS t;

Queries

SELECT * FROM t WHERE x > 5;
SELECT a, COUNT(*) FROM t
  GROUP BY a HAVING COUNT(*) > 1;
SELECT * FROM t1
  JOIN t2 ON t1.id = t2.fk;

Data Manipulation

INSERT INTO t (a, b)
  VALUES (1, 'x'), (2, 'y');
UPDATE t SET a = 10 WHERE id = 1;
DELETE FROM t WHERE a IS NULL;

Functions

COUNT, SUM, AVG, MIN, MAX
LENGTH, UPPER, LOWER, TRIM
SUBSTR, REPLACE, INSTR
COALESCE, NULLIF, IIF
date, time, datetime, strftime

Window Functions

ROW_NUMBER() OVER (
  PARTITION BY col
  ORDER BY col2
)
RANK, DENSE_RANK, NTILE
LAG, LEAD, FIRST_VALUE

CTEs & Subqueries

WITH cte AS (
  SELECT a, COUNT(*) AS cnt
  FROM t GROUP BY a
)
SELECT * FROM cte
  WHERE cnt > 1;

How It Works

In-Browser SQLite

This playground runs a complete SQLite database engine in your browser using WebAssembly. No server required — your queries and data never leave your device.

Full SQL Support

Supports CREATE, INSERT, UPDATE, DELETE, SELECT with JOINs, subqueries, CTEs, window functions, aggregations, indexes, views, triggers, and more.

Multiple Statements

Run multiple SQL statements in sequence separated by semicolons. Each statement's results display separately with execution timing.

Schema Inspector

Click "Schema" to view all tables in your database with their CREATE TABLE definitions. Useful for checking column names and types.

Powered by sql.js (SQLite compiled to WebAssembly). Your SQL and data are processed entirely in your browser — nothing is sent to any server. Database resets when you refresh the page.

Understanding SQL JOINs

SQL JOINs combine rows from two or more tables based on a related column. The most common types are INNER JOIN (returns only matching rows), LEFT JOIN (all rows from the left table plus matches), and CROSS JOIN (every combination of rows). SQLite supports INNER JOIN, LEFT JOIN, and CROSS JOIN but not RIGHT JOIN or FULL OUTER JOIN — you can achieve RIGHT JOIN by swapping table order in a LEFT JOIN.

INNER JOIN Example

INNER JOIN is the default and most common join type. It returns only rows where the join condition matches in both tables. If an employee has no matching department, that row is excluded from results.

SELECT e.name, d.name AS department
FROM employees e
INNER JOIN departments d
  ON e.department_id = d.id;

LEFT JOIN for Optional Relationships

LEFT JOIN returns all rows from the left table, filling in NULLs where no match exists in the right table. This is essential for finding missing relationships — for example, customers who have never placed an order, or products with no reviews.

SELECT c.name, COUNT(o.id) AS order_count
FROM customers c
LEFT JOIN orders o ON c.id = o.customer_id
GROUP BY c.id
HAVING order_count = 0;

Self-Joins and Multi-Table JOINs

A self-join joins a table to itself — useful for hierarchical data like org charts (employee → manager) or finding duplicates. Multi-table JOINs chain multiple JOIN clauses: SELECT * FROM orders o JOIN customers c ON o.customer_id = c.id JOIN products p ON o.product_id = p.id.

Frequently Asked Questions

What is the difference between INNER JOIN and LEFT JOIN?

INNER JOIN returns only rows with matches in both tables. LEFT JOIN returns all rows from the left table, with NULLs for non-matching right-table columns.

Does SQLite support RIGHT JOIN or FULL OUTER JOIN?

SQLite supports RIGHT JOIN as of version 3.39.0 (2022). FULL OUTER JOIN is also supported since 3.39.0. This playground uses the latest sql.js which includes these features.

How do I practice JOINs online?

Use DevBolt's SQL Playground to create tables with related data and write JOIN queries. Click the 'JOINs' sample to load a pre-built employees/departments schema, then modify the queries to experiment.

Related Inspect Tools