Build SQL queries visually for four databases
This SQL query builder turns your table definitions into a point-and-click editor. Paste CREATE TABLE statements (or quick table: col1, col2 lines), then build a SELECT with joins, column choices, aggregates, grouped WHERE conditions, GROUP BY/HAVING, sorting and paging — or an INSERT, UPDATE or DELETE — and read neatly formatted SQL as you go.
Pick the dialect and the output follows its rules: backticks for MySQL and MariaDB, double quotes for PostgreSQL and SQLite, square brackets for SQL Server; LIMIT … OFFSET versus TOP and OFFSET … FETCH NEXT; TRUE/FALSE versus 1/0; native ILIKE in PostgreSQL with a LOWER() LIKE fallback elsewhere. Join conditions are suggested from foreign keys or customer_id-style naming, and string values are escaped. A parameter mode emits ?, $1 or @p1 placeholders with the values listed separately, the safe way to run queries from code.
Everything happens in your browser; the builder never connects to a database.
How to use the SQL Query Builder
- Paste your schema into Tables —
CREATE TABLEoutput from a migration orSHOW CREATE TABLEworks — or use the sample shop schema. - Choose the Statement type and the Dialect.
- For SELECT, pick the From table, press Add join for related tables (the ON columns are pre-filled), tick the columns and add aggregates such as
COUNT(*). - Add condition groups. Conditions inside a group are combined with AND or OR, and groups are combined with each other — giving queries like
(a OR b) AND c. - Add sorting, limit and offset, then copy the SQL or download it as a
.sqlfile. Tick Use parameters to get placeholders for application code.
SQL Query Builder features
Schema-aware
Tables, column types and foreign keys are read from CREATE TABLE statements, including quoted identifiers, inline REFERENCES and table-level FOREIGN KEY constraints.
Real dialect differences
Identifier quoting, row limiting (LIMIT/OFFSET, TOP, OFFSET-FETCH), boolean literals, ILIKE and unsupported joins (FULL JOIN in MySQL, RIGHT/FULL in older SQLite) are handled or flagged per database.
Grouped WHERE logic
Any number of condition groups with AND/OR inside and between them, and operators =, !=, <, >, LIKE, ILIKE, IN, BETWEEN, IS NULL and IS NOT NULL.
Typed, escaped literals
Numbers stay unquoted for numeric columns, booleans become TRUE/FALSE or 1/0, NULL is recognised and quotes inside strings are doubled — or switch to bound parameters.
Safety warnings
UPDATE and DELETE without a WHERE clause, empty comparison values and ORDER BY requirements for SQL Server paging are called out before you run anything.
Dialect differences the builder handles
- * MySQL and SQL Server comparisons are often case-insensitive already, depending on the column collation.
| Feature | MySQL / MariaDB | PostgreSQL | SQLite | SQL Server |
|---|---|---|---|---|
| Quoted identifier | `name` | "name" | "name" | [name] |
| First 50 rows | LIMIT 50 | LIMIT 50 | LIMIT 50 | SELECT TOP (50) |
| Rows 101–150 | LIMIT 50 OFFSET 100 | LIMIT 50 OFFSET 100 | LIMIT 50 OFFSET 100 | OFFSET 100 ROWS FETCH NEXT 50 ROWS ONLY (needs ORDER BY) |
| Boolean literal | TRUE | TRUE | 1 | 1 (BIT) |
| Case-insensitive match | LOWER() LIKE* | ILIKE | LOWER() LIKE | LOWER() LIKE* |
| Placeholder | ? | $1 | ? | @p1 |
Tips for correct queries
- Every non-aggregated column must be grouped. When you add an aggregate, the builder groups by all ticked columns automatically, which satisfies MySQL’s
ONLY_FULL_GROUP_BYand the SQL standard. - Use HAVING for aggregate filters (
COUNT(*) > 1) and WHERE for row filters — WHERE runs before grouping. - LEFT JOIN plus a WHERE on the joined table silently turns into an inner join; filter such columns in the ON clause in your editor if you need the outer rows.
- Prefer parameters in application code. Literal values are escaped here, but bound parameters are the robust defence against SQL injection.
- Tidy hand-edited SQL with the SQL Formatter and check its syntax for your database with the SQL Validator.
SQL Query Builder FAQ
Does the SQL query builder connect to my database?
No. It only reads the table definitions you paste and generates SQL text in your browser. Run the query in your own client, such as psql, MySQL Workbench, DBeaver or SQL Server Management Studio.
Which CREATE TABLE syntax is understood?
Standard CREATE TABLE from MySQL, PostgreSQL, SQLite and SQL Server dumps, with quoted or bracketed names, column types, inline REFERENCES and table-level FOREIGN KEY constraints. Indexes, checks and other constraints are skipped. You can also type table: col1, col2 lines.
How are join conditions chosen?
From declared foreign keys first, then from naming conventions such as orders.customer_id = customers.id. You can change either side of the ON condition with the drop-downs.
Can I build OR conditions?
Yes. Set a group to “any (OR)” to combine its conditions with OR, or add several groups and combine the groups with AND or OR. Groups are wrapped in parentheses so precedence is explicit.
Why does SQL Server output use TOP instead of LIMIT?
T-SQL has no LIMIT. A plain limit becomes SELECT TOP (n); a limit with an offset becomes OFFSET … ROWS FETCH NEXT … ROWS ONLY, which requires an ORDER BY.
Are subqueries, UNION or window functions supported?
Not in the visual builder, which focuses on the everyday SELECT-JOIN-WHERE-GROUP pattern and single-table writes. Generate the main query here and add advanced clauses by hand.