SQL Tools

Drag clause blocks to compose a SELECT query — see the SQL update live and learn what each clause does.

Blocks

Drag onto the canvas, or click to add.

Query canvas

SELECT
step 1

SELECT lists the columns you want back. Use * for every column, or a comma-separated list. Add DISTINCT to drop duplicate rows.

FROM
step 2

FROM names the source table. An alias (e.g. u) lets you write shorter, clearer references like u.email in the rest of the query.

SQL

SELECT
  *;

The FROM block needs a table name.

Templates

Load a ready-made query to learn its shape, then tweak the blocks.

Simple select

Fetch a few columns from one table with a filter.

SELECT id, name, email
FROM users AS u
WHERE u.active = true
ORDER BY u.created_at DESC
LIMIT 25;

Start here: SELECT picks the columns, FROM names the table, and WHERE filters before any sorting. Add ORDER BY and LIMIT to control order and volume.

Join two tables

Combine orders with their customer via a LEFT JOIN.

SELECT o.id, o.total, c.name
FROM orders AS o
LEFT JOIN customers AS c ON c.id = o.customer_id
WHERE o.status = 'paid'
ORDER BY o.total DESC;

A LEFT JOIN keeps every row from the first (FROM) table even with no match, so customers without orders still appear. Use INNER JOIN when you only want matches.

Group & aggregate

Count orders per customer and keep only the busy ones.

SELECT c.name, COUNT(*) AS order_count
FROM orders AS o
INNER JOIN customers AS c ON c.id = o.customer_id
GROUP BY c.name
HAVING COUNT(*) > 5
ORDER BY order_count DESC;

GROUP BY collapses rows that share the listed column into one. Filter the groups with HAVING — it runs after aggregation, so it can test COUNT(*) or SUM() which WHERE cannot.

Paginate results

Page through rows with ORDER BY and LIMIT + OFFSET.

SELECT id, title, created_at
FROM posts AS p
WHERE p.published = true
ORDER BY p.created_at DESC
LIMIT 20 OFFSET 40;

OFFSET skips rows before LIMIT returns them. Page 3 of 20 rows is LIMIT 20 OFFSET 40. Always pair it with ORDER BY so the same row never shows up on two pages.

About this tool

SQL Builder lets you assemble a SELECT query by dragging clause blocks onto a canvas instead of typing raw SQL. Grab a SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY or LIMIT block from the palette, drop it in, fill in the fields, and watch a clean, formatted query build up live on the right. Drop blocks in any order — the tool always emits them in the correct SQL clause sequence, so you can't create a syntactically-broken statement.

It's designed to be both a teacher and an accelerator. Every block carries a plain-language tip explaining what the clause does and how it fits into query execution — how WHERE filters before grouping, why HAVING needs a GROUP BY, what an INNER versus LEFT JOIN keeps — so beginners can learn the anatomy of a query by building one. For experienced developers it's a fast scaffold: sketch a query visually, tweak the fields, pick your dialect, and copy production-ready SQL.

The output is beautified with the same engine as the SQL Formatter and supports all 11 of its dialects, from PostgreSQL and MySQL to BigQuery and Snowflake. Everything runs in your browser — table names, columns and conditions you type never leave your device.

How to use

  1. Add clause blocks

    Drag a block from the Blocks palette onto the canvas, or click it to add. SELECT and FROM start on the canvas; add JOIN, WHERE, GROUP BY and more as you need them.

  2. Fill in each block

    Enter table names, columns, join conditions and filters in the fields on each block. The SQL preview on the right updates instantly with every change.

  3. Learn as you build

    Keep the Tips toggle on to read a short explanation of what each clause does. Warnings point out missing pieces — like a JOIN without an ON condition — so you learn the rules of valid SQL.

  4. Reorder and refine

    Drag blocks to reorder them or use a template to load a common query shape. Repeatable blocks like JOIN and WHERE can be added multiple times.

  5. Pick a dialect and copy

    Choose your database dialect so the SQL formats correctly, then copy the ready-to-run query.

Clause blocks

BlockWhat it adds
SELECTColumns to return, with an optional DISTINCT
FROMThe source table, with an optional alias
JOININNER / LEFT / RIGHT / FULL / CROSS join with an ON condition (repeatable)
WHERERow filter applied before grouping (repeatable, AND-combined)
GROUP BYColumns to aggregate rows over
HAVINGFilter on aggregates, after grouping (repeatable)
ORDER BYSort columns with ASC / DESC direction
LIMITRow cap, with an optional OFFSET for pagination

Output is formatted for 11 dialects and generated entirely in your browser.

Frequently asked questions