SQL UPDATE Generator

Generate a parameterized UPDATE with a mandatory WHERE: no filter, no statement, so you never update a whole table by accident.

Options

Input

Ctrl + Enter to run

Result

Generate a parameterized UPDATE from JSON with two objects: "set" (columns to change) and "where" (equality conditions joined with AND). The filter is mandatory: with no "where" or an empty one nothing is generated, so you never update a whole table by accident.

Values are never written into the SQL: they go as separate parameters using the placeholder of each dialect’s usual driver ($1 for PostgreSQL, ? for MySQL, @p1 for SQL Server, :1 for Oracle). This prevents SQL injection even when a value contains quotes or semicolons.

How to use it

  1. Enter the table name and choose the dialect.
  2. Paste the JSON with "set" and "where".
  3. Press Run and pass the parameters to the driver.

Example

Example input
{
  "set": {"email": "ana.nueva@example.com", "active": true},
  "where": {"id": 42, "deleted_at": null}
}
Result
UPDATE "users"
SET "email" = $1,
    "active" = $2
WHERE "id" = $3
  AND "deleted_at" IS NULL;

-- Parameters in order ($1, $2… (node-postgres, libpq)):
-- ["ana.nueva@example.com", true, 42]

Limitations

  • Conditions are AND-joined equalities only; edit the result for ranges or OR.
  • A null in "where" becomes IS NULL.

FAQ

What if I really want to update every row?
Write it by hand, deliberately. This tool prioritizes preventing the most costly mistake.
Why does null in the filter not use a parameter?
Because “column = NULL” is never true in SQL; the correct form is IS NULL.

Related tools

References