SQL WHERE Clause Builder
Compose SQL WHERE clauses visually. Add conditions, group with parentheses, combine with AND/OR, and export inline or parameterized SQL for MySQL, PostgreSQL, SQLite, and SQL Server.
Output Setup
Conditions
4Use Open/Close parens to group conditions. Type "auto" detects numbers, true/false, and NULL — pick "raw" to inject a column reference or SQL function unquoted.
Generated SQL
Updated live as you edit.
WHERE
"status" = 'active'
OR ("age" >= 18
AND "role" IN ('admin', 'owner'))
AND "deleted_at" IS NULLAbout SQL WHERE Clause Builder
The WHERE clause is the part of a SQL query that filters rows. It accepts boolean expressions joined by AND / OR, grouped with parentheses,
and built from comparison operators (=, !=, <, >=),
set tests (IN, NOT IN),
range checks (BETWEEN), pattern matching
(LIKE), and null tests (IS NULL).
This builder turns a row-by-row form into a valid WHERE clause for four common dialects — MySQL, PostgreSQL, SQLite, and SQL Server — with correct identifier quoting (backticks, double quotes, square brackets), boolean rendering, and string escaping. It can emit the clause inline (values substituted) or as parameterized SQL with a values list, ready to hand to a prepared statement or ORM.
Everything runs in your browser — no SQL is sent anywhere, nothing is logged.
How to Use SQL WHERE Clause Builder
- Pick the SQL dialect that matches your database. Identifier quoting and boolean output change accordingly.
- Choose a parameter style: inline values for ad-hoc queries, or
?/$1/@p1/:namefor prepared statements. - Use the output prefix to emit just the WHERE clause, a full SELECT, or only the bare conditions.
- Add a row per condition. Enter the column name, pick an operator, and type the value. For
INandBETWEEN, separate values with commas. - Use the Open ( and Close ) selectors to group conditions — useful when mixing AND and OR.
- Toggle AND / OR between rows to connect conditions.
- The Type column controls value rendering: auto guesses from the text, raw injects the value unquoted (for column references or SQL functions).
- Copy the generated SQL (and parameter list, if parameterized) and paste it into your client or code.
Common Use Cases
Ad-hoc queries
Compose multi-condition filters for a DB client without hand-escaping strings or remembering dialect quoting.
Prepared statements
Generate parameterized SQL + a JSON values list ready for node-postgres, mysql2, sqlite3, or mssql.
Reports & analytics
Build complex date-range filters with BETWEEN, IN, and grouped OR conditions for analytics queries.
ORM raw escapes
Drop into Sequelize.literal, Knex.raw, or Prisma raw queries when the ORM filter API is too limiting.
Code review
Quickly prototype the SQL a teammate is building in an ORM and compare the expected output.
Teaching SQL
Show students how AND, OR, parentheses, and operator choice change a query without typos.
FAQ
How does the builder quote identifiers?
It uses the dialect convention: `backticks` for MySQL, "double quotes" for PostgreSQL and SQLite,
and [square brackets] for SQL Server.
Dot notation (schema.table.column) is quoted per-segment.
Is the inline-value output safe to use as a prepared statement?
Inline mode escapes single quotes inside strings, which is enough for trusted, hand-typed values — but for any user-controlled
input you should switch to a parameter style (?, $1, etc.) and bind the values through your driver. That is the only safe
way to avoid SQL injection.
When do I need parentheses?
Whenever you mix AND and OR.
SQL evaluates AND with higher precedence than OR, so a OR b AND c means a OR (b AND c). Group your conditions explicitly with the Open/Close selectors
when that is not what you want.
What does the "raw" value type do?
It inserts the value text as-is, without quoting. Use it to compare a column to another column
(updated_at > created_at), or to call a SQL function like NOW(), CURRENT_DATE,
or LOWER('value'). The builder will not escape the text — that is on you.
How do I write LIKE patterns?
Put the pattern in the value field including wildcards: %alice% for substring, alice% for prefix, _lice for
a single unknown character. The builder will quote it as a string — you do not need to add extra quotes.
Why is my boolean column generating 1 / 0?
MySQL, SQLite, and SQL Server store booleans as 0/1 (they have no native boolean type), so the builder writes 0/1 for those dialects.
PostgreSQL uses real booleans, so you'll see TRUE and FALSE instead.
Does the tool send data anywhere?
No. All parsing, escaping, and SQL building happens locally in your browser. No telemetry, no upload, no signup.