Zero Signup ToolsFree browser tools

Developer Tools

SQL WHERE Clause Builder

Build a parameterized SQL WHERE clause from conditions and groups. Supports MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and BigQuery.

SQL options

Pick the SQL dialect and how values should appear in the output.

Output style
Group 1
Condition 1
Condition 2
Group 2
Condition 1
Condition 2
Groups combine with AND. Use a new group when you need parentheses to change precedence.

WHERE clause

("status" = $1
  AND "created_at" >= $2)
  AND ("plan" IN ($3, $4, $5)
  OR "trial" = $6)

Full SELECT statement

SELECT *
FROM "users"
WHERE
  ("status" = $1
  AND "created_at" >= $2)
  AND ("plan" IN ($3, $4, $5)
  OR "trial" = $6);

Parameter values (in order)

These are the values your driver expects in the order the placeholders appear in the WHERE clause. Numbered $1, $2 placeholders: pass this array directly to pg or node-postgres.

[
  "active",
  "2026-01-01",
  "pro",
  "team",
  "enterprise",
  true
]

How parameters and quoting differ across dialects

  • MySQL / MariaDB: identifiers in backticks, ? placeholders by default, BOOLEAN emits TRUE / FALSE, != is the canonical not-equal operator.
  • PostgreSQL: identifiers in double quotes, $1, $2 placeholders by default, native ILIKE for case-insensitive matches, DATE and TIMESTAMP literal prefixes for typed date values.
  • SQLite: identifiers in double quotes, ? placeholders by default, BOOLEAN stored as 0 / 1, dates as plain quoted strings.
  • SQL Server: identifiers in [square brackets], @p1, @p2 placeholders by default, <> for not-equal, BIT (0 / 1) instead of BOOLEAN.
  • Oracle: identifiers in double quotes, :p1, :p2 named placeholders, TO_DATE for date literals, no native boolean (1 / 0 idiom).
  • BigQuery: identifiers in double quotes (or backticks for projects), @p1, @p2 named placeholders, native DATE / TIMESTAMP literal prefixes.

How to use

  1. Pick the SQL dialect and the parameter style that matches your driver (positional ?, numbered $1, named :p1, named @p1, or inline literals).
  2. Set the table name and optional schema so the full SELECT preview reflects your query.
  3. Add conditions inside the first group. For each one, type the column name, pick the operator, choose the value type (string, number, boolean, date, NULL, or raw expression), and enter the value.
  4. Use additional groups when you need parentheses to control AND / OR precedence; each group has its own combinator and an optional NOT wrap.
  5. Copy the WHERE clause, the full SELECT statement, or the JSON array of parameter values into your code, query console, or migration script.

About this tool

SQL WHERE Clause Builder composes a SQL WHERE expression from a small form so you can stop hand-stitching predicates that break in production. Add conditions inside groups (each group becomes a parenthesised subexpression), pick the operator per condition (=, !=, <, <=, >, >=, LIKE, NOT LIKE, ILIKE on Postgres, IN, NOT IN, BETWEEN, NOT BETWEEN, IS NULL, IS NOT NULL, EXISTS, NOT EXISTS, plus a raw SQL escape hatch), and the tool emits a clean WHERE clause and a full SELECT preview. Six dialects ship: MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and BigQuery. Each dialect handles identifier quoting, parameter placeholders, the not-equal operator, boolean literals, and date literals in its own way, and the builder applies those rules for you so the same form gives correct output everywhere. Five parameter styles are supported (positional ?, numbered $1, named :p1, named @p1, and inline literals), and a separate panel lists the parameter values in the order placeholders appear so they paste directly into your driver call. The builder also catches the small mistakes that trip up hand-written SQL: empty values that should be IS NULL, LIKE patterns with no wildcard, ILIKE on a non-Postgres dialect (auto-fallback to LOWER()), and empty IN lists. Everything runs in your browser, so the column names, table names, and values you type never leave your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools