SQL Query Builder
Visual SQL query builder for SELECT, INSERT, UPDATE, DELETE
Acerca de esta herramienta
Build SQL queries visually without memorising syntax. Enter a table name, add or remove columns, define WHERE conditions with field / operator / value rows, set ORDER BY and LIMIT clauses, and choose between SELECT, INSERT, UPDATE, and DELETE templates. The generated SQL is syntax-highlighted and ready to copy with a single click.
Cómo usar
- 1 Select the query type (SELECT, INSERT, UPDATE, or DELETE) from the tabs.
- 2 Enter the table name.
- 3 Add the columns you want to include (for SELECT/UPDATE/INSERT).
- 4 Add WHERE conditions by clicking 'Add Condition' and filling in field, operator, and value.
- 5 Set ORDER BY column and LIMIT if needed, then copy the generated SQL.
What a query builder buys you
SQL is unforgiving about punctuation: a missing comma between columns, an unquoted string, or a stray AND at the start of a WHERE clause turns a valid statement into a syntax error. This builder removes that friction by assembling the statement for you from structured inputs — table name, columns, conditions — and rendering syntax-highlighted SQL you can copy straight into your database client. It runs entirely in your browser; it never connects to a database or executes anything, so it is a safe place to draft and learn queries without touching live data.
The four statement types and their anatomy
The tabs at the top switch between the four core data-manipulation statements. Each one uses the form fields differently:
| Type | Uses columns | Uses values | Uses WHERE |
|---|---|---|---|
| SELECT | Yes (or * if none) | No | Optional, plus ORDER BY / LIMIT |
| INSERT | Yes (column names) | Yes (paired values) | No |
| UPDATE | Yes (SET targets) | Yes (new values) | Optional but important |
| DELETE | No | No | Optional but critical |
When you switch to SELECT and leave the column list empty, the builder emits SELECT *. For INSERT and UPDATE, each column row gains a second field for the value to write.
A worked example
Pick SELECT, set the table to orders, list the columns id, customer, and total, then add a WHERE condition total > 100 and a second one with logic AND, status = shipped. Set ORDER BY to total DESC and LIMIT to 10. The builder produces:
SELECT id, customer, totalFROM ordersWHERE total > 100AND status = 'shipped'ORDER BY total DESCLIMIT 10;
Notice two automatic decisions. The number 100 is left unquoted because it matches a numeric pattern, while shipped is wrapped in single quotes because it is text. And the first condition has no AND in front of it — the logic keyword only appears between conditions, never at the start. Getting both of those right by hand is exactly where beginners slip.
How values are quoted
The builder inspects each value and quotes it intelligently. A bare integer or decimal like 42 or 3.14 stays unquoted. Anything else becomes a single-quoted string, and any apostrophe inside your text is escaped so the surrounding quotes don't break. There is one deliberate special case: if your value already starts with ( and ends with ) — for example (1, 2, 3) — it is passed through untouched, which is what you want for an IN condition. So an IN condition with the value (10, 20, 30) produces field IN (10, 20, 30) rather than a quoted mess.
The most dangerous mistake, and how to avoid it
An UPDATE or DELETE without a WHERE clause affects every row in the table. The builder will happily generate DELETE FROM users; if you add no conditions — that statement erases the entire table. Always add at least one WHERE condition before running an UPDATE or DELETE against real data, and consider running the equivalent SELECT with the same WHERE first to preview exactly which rows will be touched. This builder is a drafting aid, not a safety net; review the generated SQL before executing it.
Practical tips
- Use the WHERE operators fully. Beyond
=, the operator dropdown includesLIKEfor pattern matching,INfor sets, andIS NULL/IS NOT NULL— and when you pick a NULL operator the value field disappears, because those operators take no value. - Quote your
LIKEwildcards correctly. Enter the value as%smith%; the builder quotes it for you, yieldingname LIKE '%smith%'. - Dialect differences exist. The output uses standard SQL with single-quoted strings. Some databases prefer
"for identifiers or useTOPinstead ofLIMIT(SQL Server). Adjust after copying if your engine differs. - Empty values become empty strings. A blank value field produces
'', notNULL— use theIS NULLoperator or edit the output if you truly mean NULL. - Copy, then test in a transaction. For destructive statements, wrap the copied SQL in a transaction so you can roll back if the row count surprises you.
A learning aid as much as a productivity tool
Beyond saving keystrokes, the syntax highlighting makes the structure of a statement visible: keywords in blue, string literals in green, numbers in amber. Watching the output update as you toggle between SELECT, INSERT, UPDATE, and DELETE is one of the fastest ways to internalize how the four statements share a vocabulary but arrange it differently — SELECT pulls columns out, INSERT pushes values in, UPDATE rewrites matched rows, and DELETE removes them. If you are new to SQL, build the same logical change as both a SELECT and an UPDATE side by side: read the rows first, confirm the WHERE clause is correct, and only then trust the version that modifies them.
Preguntas frecuentes
Embellezca y formatee consultas SQL desordenadas con sangría adecuada y mayúsculas de palabras clave — al instante.
Convert JSON arrays into formatted HTML tables with sorting, zebra striping, and CSV export.
Convierta datos CSV a JSON y arreglos JSON de vuelta a CSV — con opciones de delimitador y vista previa en vivo.