SQL Query Builder – Visual SELECT Generator
NEWSQL query builder: assemble a SELECT with joins, WHERE groups, GROUP BY, HAVING, ORDER BY and LIMIT, with correct quoting for MySQL, PostgreSQL, SQLite or SQL Server.
Runs 100% in your browser — your input is never uploaded or stored on our servers.
Generated SQL
SELECT
`u`.`id`,
`u`.`name` AS `user_name`,
COUNT(o.id) AS `orders`
FROM `users` AS `u`
LEFT JOIN `orders` AS `o` ON `o`.`user_id` = `u`.`id`
WHERE `u`.`active` = 1
AND (`u`.`country` IN ('VN', 'FR') OR `u`.`name` LIKE 'O''Brien%')
GROUP BY `u`.`id`, `u`.`name`
HAVING COUNT(o.id) > 5
ORDER BY `orders` DESC
LIMIT 10;Values that look like numbers are written unquoted (choose "text" to force quotes). Text in parentheses, e.g. COUNT(*), is treated as a raw expression and not quoted.
Quick Examples
Typical inputs and the results this tool produces.
Overview
This SQL query builder lets you compose a SELECT statement with form fields instead of typing it by hand. Pick the table, the columns and their aliases, add INNER, LEFT or RIGHT joins, combine WHERE conditions in AND/OR groups, then add GROUP BY, HAVING, ORDER BY and paging. The formatted SQL updates as you edit.
It is useful for learning SQL, drafting reports, or getting dialect details right: identifiers are quoted with backticks for MySQL, double quotes for PostgreSQL and SQLite, and square brackets for SQL Server, while string values are escaped by doubling single quotes. LIMIT/OFFSET becomes TOP or OFFSET … FETCH on SQL Server.
The query is generated locally in your browser and is never executed or sent anywhere — no database connection is needed.
Why use this tool?
- Correct quoting for four SQL dialects
- Safe escaping of quotes in values
- Nested AND/OR condition groups
- Readable, consistently formatted output
- No database connection required
Features
Visual SELECT
Columns with aliases, DISTINCT, table alias and any number of joins.
Condition groups
Thirteen operators including IN, BETWEEN, LIKE and IS NULL, grouped with AND/OR.
Dialect aware
MySQL, PostgreSQL, SQLite and SQL Server quoting and paging syntax.
Value escaping
Quotes are doubled, MySQL backslashes escaped and SQL Server Unicode text gets N'…'.
Aggregates
GROUP BY and HAVING with raw expressions such as COUNT(*) or SUM(total).
Copy SQL
Copy the formatted query with one click.
How to Use
Choose a dialect
Select MySQL, PostgreSQL, SQLite or SQL Server and the FROM table.
Add columns and joins
List columns with optional aliases and add joins with their ON columns.
Filter and group
Build WHERE conditions, GROUP BY columns and HAVING conditions.
Sort, page, copy
Set ORDER BY, LIMIT and OFFSET, then press Copy SQL.