How to use the SQL Query Builder
- 1. Name the tableEnter the table, the columns you want and pick your database.
- 2. Add conditionsWrite one condition per line, like salary > 50000 or city IN Noida, Delhi.
- 3. Copy the SQLBuild the query, then copy it or download a .sql file.
How the builder writes your query
SQL clauses always run in a fixed order: SELECT → FROM → JOIN → WHERE → GROUP BY → HAVING → ORDER BY → LIMIT. The builder places each part in that order, so you never get a HAVING before a GROUP BY by mistake.
With the default inputs (table employees, columns name, dept, salary, conditions salary > 50000 and dept = Sales, order salary DESC, limit 10) the MySQL output is:
SELECT name, dept, salary FROM employees WHERE salary > 50000 AND dept = 'Sales' ORDER BY salary DESC LIMIT 10;
Numbers stay as numbers, and text is wrapped in single quotes. A name like O'Brien becomes 'O''Brien', which is how SQL escapes a quote.
Differences between databases
- MySQL, PostgreSQL, SQLite: row limits use
LIMIT nat the end. - SQL Server: uses
SELECT TOP nright after SELECT. - Oracle 12c and later: uses
FETCH FIRST n ROWS ONLY, which needs ORDER BY for a stable result. - RIGHT JOIN: SQLite added it only in version 3.39, so the builder suggests swapping tables to a LEFT JOIN.
This tool builds text only. It does not connect to any database. When you put user input into SQL inside an app, use parameterised queries so the driver handles quoting and you stay safe from SQL injection.
Practise the result with the SQL practice questions, or tidy a long query with the SQL formatter.
Frequently asked questions
Can it build UPDATE or DELETE queries?
No. It builds SELECT queries only, which covers most reporting and practice work.
Does it check that my columns exist?
No. It has no access to your database. It checks that names are valid SQL identifiers and that each condition has the right shape.
Is the SQL Query Builder free?
Yes, the SQL Query Builder is free. The first time you build your first query, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.