Build SELECT

Build a SQL SELECT with columns, joins, filters, grouping, and ordering.

freeworks offlinenothing uploaded
ToolSELECT Builder
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Chosen columns, aliases, sources, joins, predicates, grouping, ordering, and limits are emitted in clause order. Identifiers are kept separate from literal values so parameters can remain placeholders.

  • Simple SELECT is the safest starting point.
  • Optional clauses appear only when the result needs them.

Worked example

User Orders Query
Build a SELECT query joining users and orders
Input
											Table: users
Table alias: u
Columns: ["u.name","o.total"]
Joins: [{"type":"INNER","table":"orders","alias":"o","on":"u.id = o.user_id"}]
Where: [{"column":"o.total","operator":">","value":100}]
Order by: [{"column":"o.total","direction":"DESC"}]
Limit: 10
										
Output
												SELECT
  u.name,
  o.total
FROM
  users u
INNER JOIN orders o
  ON u.id = o.user_id
WHERE
  o.total > 100
ORDER BY
  o.total DESC
LIMIT 10;
											

When to use this

API list endpoints, reports, and analyst queries build SELECT statements.

Edge cases

  • An aggregate without GROUP BY returns one aggregate row.
  • An alias usually cannot be reused in the same SELECT expression.
  • LIMIT without ORDER BY does not define which rows are chosen.

References