How to build SQL queries visually
This SQL query builder generates clean, readable SQL from a form. Pick a statement type — SELECT, UPDATE, DELETE, TRUNCATE or JOIN — fill in the table, columns and conditions, and the query is written for you with consistent formatting and syntax highlighting.
It is useful for drafting ad-hoc queries, teaching or learning SQL syntax, and avoiding typos in WHERE clauses when you're in a hurry. The builder only writes SQL; it never connects to a database, and nothing you type leaves your browser.
How to use the SQL builder
- Choose a tab for the statement type.
- Enter the table name and, for
SELECT, the columns you want (leave empty for*). - Add
WHEREconditions. Each condition has a column, an operator (=,!=,>,<,>=,<=,LIKE,NOT LIKE,IN,IS NULL,IS NOT NULL) and a value, and conditions can be chained withANDorOR. - For
SELECTandJOIN, optionally setORDER BYwith direction and aLIMIT. - For
UPDATE, add theSETcolumn/value pairs. ForJOIN, chooseINNER,LEFT,RIGHTorFULL OUTER, the two tables and theONcondition that links them (e.g.orders.user_id = users.id). - Copy the generated query into your SQL client.
Values are quoted for you: numbers, NULL, TRUE and FALSE are left bare, text is wrapped in single quotes, and IN lists are wrapped in parentheses. For example:
SELECT id, email, created_at
FROM users
WHERE status = 'active'
AND created_at >= '2026-01-01'
ORDER BY created_at DESC
LIMIT 50;Choosing the right JOIN
| Join | Returns |
|---|---|
INNER JOIN | Only rows with a match in both tables |
LEFT JOIN | All rows from the left table, with NULLs where the right table has no match |
RIGHT JOIN | All rows from the right table, with NULLs where the left has no match |
FULL OUTER JOIN | All rows from both tables (not supported natively in MySQL — emulate with LEFT JOIN … UNION … RIGHT JOIN) |
A frequent bug: filtering the right-hand table of a LEFT JOIN in the WHERE clause (WHERE orders.status = 'paid') silently turns it into an inner join, because rows with no order have NULL status. Put that condition in the ON clause instead if you want to keep unmatched rows.
Safety checks before you run it
UPDATEandDELETEwithoutWHEREaffect every row. Run the same conditions as aSELECT COUNT(*)first, and use a transaction (BEGIN; … ROLLBACK;) when trying a change on production data. MySQL's--safe-updatesmode blocks key-less updates entirely.TRUNCATEcan't be filtered and, in MySQL, can't be rolled back — it removes all rows and resets auto-increment counters.= NULLnever matches. UseIS NULL/IS NOT NULL; the builder offers them as operators for this reason.LIKEwith a leading wildcard ('%term') can't use a normal B-tree index and scans the table.- Don't paste user input into SQL in application code. The builder is for writing queries by hand. In applications, always use parameterised queries or an ORM to prevent SQL injection.
Dialect notes
The output is standard SQL that runs as-is on PostgreSQL, MySQL/MariaDB and SQLite for the statement types covered. Differences to watch: SQL Server uses TOP n or OFFSET … FETCH instead of LIMIT; identifiers that are reserved words or contain spaces need quoting — "name" in PostgreSQL and standard SQL, backticks in MySQL, [name] in SQL Server.
Frequently asked questions
Does the SQL builder connect to my database?
No. It only generates SQL text in your browser. Copy the query into your own client — psql, MySQL Workbench, DBeaver, DataGrip — to run it.
Which databases does the generated SQL work with?
The SELECT, UPDATE, DELETE, TRUNCATE and JOIN statements use standard syntax that works in PostgreSQL, MySQL, MariaDB and SQLite. SQL Server needs TOP instead of LIMIT, and MySQL doesn't support FULL OUTER JOIN.
How do I write an IN condition?
Choose the IN operator and enter comma-separated values, e.g. 'paid', 'shipped' or 1, 2, 3. The builder wraps them in parentheses.