Visual SQL Query Builder
Assemble a SELECT statement from a form — table, columns, WHERE, GROUP BY, ORDER BY, LIMIT
Query Builder
Generated SQL
About this tool
This tool assembles a SQL SELECT statement from a form: pick the table, list columns (or *), toggle DISTINCT, add WHERE conditions with operators and AND/OR logic, set GROUP BY and ORDER BY clauses, and a LIMIT. It emits a formatted, copy-ready SQL string with properly escaped string literals. Use it to draft queries without remembering syntax or to teach SQL. The builder does not execute anything — it only produces text, client-side. Existing sql-formatter and sql-tools cover formatting; this covers construction.
Examples & Use Cases
Simple select
-- Form: table=users, columns=*
SELECT *
FROM users;
-- Form: table=users, columns=id, name, WHERE active = true
SELECT id, name
FROM users
WHERE active = true;Table + columns become FROM and the projection list; the WHERE condition is appended.
Grouped + ordered with limit
SELECT department, COUNT(*) AS headcount
FROM employees
WHERE status = 'active'
GROUP BY department
ORDER BY headcount DESC
LIMIT 10;DISTINCT off, GROUP BY and ORDER BY clauses with a LIMIT.
Examples
Build a SELECT with WHERE and ORDER BY
SELECT name, email
FROM users
WHERE status = 'active' AND age >= 18
ORDER BY name ASCSELECT name, email
FROM users
WHERE status = 'active' AND age >= 18
ORDER BY name ASCString literals like 'active' are wrapped in single quotes and the query is emitted as clean, readable SQL.
Build a query with IN and LIMIT
SELECT *
FROM products
WHERE category IN ('electronics', 'books')
LIMIT 10SELECT *
FROM products
WHERE category IN ('electronics', 'books')
LIMIT 10The IN operator accepts a list of quoted string values, each escaped individually, and LIMIT caps the result set.
About this tool
Visual SQL Query Builder lets you assemble a SELECT statement through a form — no SQL syntax memorised required. Add a SELECT clause (with optional DISTINCT), specify columns, build WHERE conditions using operators =, !=, <, <=, >, >=, LIKE, IN, IS NULL, IS NOT NULL, and AND/OR combinators, then add GROUP BY, ORDER BY, and LIMIT/OFFSET.
String literals in WHERE conditions are automatically wrapped in single quotes with embedded single quotes escaped as '', the same escaping SQL engines expect. Numeric values are passed through unquoted. The builder produces syntactically correct, formatted SQL you can copy and run against any SQL database.
Everything runs client-side — table names, column names and conditions you type stay on your device.
How to use
Set SELECT and columns
Choose whether to include DISTINCT, then add one or more column names (or * for all columns).
Add WHERE conditions
Add one or more WHERE clauses. Pick a column, an operator, and a value. Use AND/OR to combine conditions. String values are escaped automatically.
Add GROUP BY and ORDER BY
Optionally add a GROUP BY clause, then add ORDER BY columns with ASC or DESC direction. Use the arrow buttons to reorder.
Set LIMIT and copy the query
Set a row limit (and optional OFFSET for pagination), then copy the formatted SQL to run against your database.
Use cases
Learning SQL interactively
Fill in the form fields and see the SQL update live — a hands-on way to understand how each clause fits into a SELECT statement without writing queries from memory.
Scaffolding a report query
Draft the skeleton of a complex report query (filters, grouping, sorting) by filling in the builder, then copy the result into your application or database tool.
Testing string escaping
Build a query with special characters in values to see how the escaping handles them before running the query against a real database.
Common mistakes
Mistake:Using double quotes around strings instead of single quotes.
Fix:SQL string literals use single quotes: WHERE name = 'Ada'. Double quotes delimit identifiers (column/table names) in standard SQL. Mixing them up causes a syntax error.
Mistake:Writing a HAVING clause without a corresponding GROUP BY.
Fix:HAVING filters aggregated rows after GROUP BY groups them — it is meaningless without an earlier GROUP BY and most SQL engines raise an error. Add GROUP BY first.
Frequently asked questions
Related guides
References & standards
Related tools
Driver's License Generator
Generate driver's license numbers in the correct format for 21 countries and all 50 US states, plus a format and Luhn validator — test data only, runs in your browser.
Address Generator
Generate realistic addresses in the correct format for 21 countries — single-line, multi-line, JSON or HTML — plus a postcode validator. Test data only, runs in your browser.
Phone Number Generator
Generate phone numbers in the correct format per country — mobile, landline and toll-free — in international, national, raw or tel: format, plus a validator. Test data only.
XML to JSON Converter
Convert XML data to JSON format with attribute handling, configurable parsing options, and live statistics
Markdown to HTML Converter
Convert Markdown to clean HTML with GitHub-Flavored Markdown, syntax highlighting, and optional sanitization
Docker Run to Compose Converter
Convert a docker run command into a docker-compose.yml service definition with full flag support