Developer Tools

SQL UPDATE Query Generator

Have a spreadsheet of new prices, stock levels or statuses? Paste it as CSV or JSON, name the key column, and get UPDATE statements that change exactly the right rows. Choose one statement per row, one UPDATE with CASE expressions, or a single UPDATE joined to a VALUES list, with a preview query, a transaction and the option to leave columns unchanged where a cell is empty.

  • Runs in your browser
  • No sign-up
  • Free to use
Start from an example

Comma-separated, usually the primary key.

Each row updates the rows whose key columns match. Columns other than the keys are set.

Options

    How to use SQL UPDATE Query Generator

    1. Paste the changes as CSV (with a header) or JSON.
    2. Enter the table and the key column(s) that identify each row.
    3. Choose the statement style and options.
    4. Run the preview, then the updates.

    SQL UPDATE Query Generator features

    CSV or JSON input

    Header row or object keys become column names.

    Key matching

    Single or composite keys; missing and duplicate keys are rejected.

    Three styles

    Per-row UPDATE, CASE expressions or a join to VALUES.

    Empty cells

    Leave columns unchanged instead of writing NULL.

    Changed rows only

    Skip rows that already have the new values.

    Safety

    Preview SELECT, transaction and escaped values.

    When to use SQL UPDATE Query Generator

    • Applying a price list from a spreadsheet to a products table.
    • Updating stock levels from a supplier export.
    • Changing the status of many orders at once.
    • Fixing data identified in a report.

    SQL UPDATE Query Generator FAQ

    Which style should I use?

    One UPDATE per row is the easiest to read and review. The CASE form and the VALUES join update everything in a single statement, which is faster for hundreds of rows.

    What happens to empty cells?

    With the option on, an empty cell leaves that column unchanged for that row. Without it, empty cells set the column to NULL.

    Why does a key have to be unique in the data?

    Two rows with the same key would update the same database row twice, and the result would depend on order. The generator reports such duplicates.

    How are values written?

    Numbers stay numbers, values with leading zeros stay text, and every string is escaped for the chosen database, so quotes in the data cannot break the SQL.

    Can I update by two columns?

    Yes, list several key columns separated by commas, for example warehouse_id, product_id.

    Is my data uploaded?

    No. The statements are generated in your browser.

    Bulk updates you can trust

    Many data changes arrive as a list: a new price list, corrected addresses, the result of a stock count. Turning such a list into SQL by hand, or with spreadsheet formulas, invites mistakes with quoting, NULL values and key matching. This generator reads the list and writes the statements for you, with checks that stop the most dangerous errors.

    Each row of the input must identify the database row it changes through one or more key columns. Rows without a key value are rejected, because WHERE id = NULL matches nothing and a missing condition would match everything. Duplicate keys are rejected as well, since the outcome would depend on execution order.

    Three statement styles cover different needs. One UPDATE per row is clear and easy to audit. A single UPDATE with a CASE expression per column changes all rows in one statement. The VALUES join, written as UPDATE … FROM in PostgreSQL, SQLite and SQL Server and as a JOIN to a derived table in MySQL, is the most efficient form for large lists.

    Spreadsheets often contain only the values that change, leaving other cells empty. With “leave columns unchanged” on, an empty cell does not overwrite the current value. The “changed rows only” option adds conditions so that rows already holding the new values are not written again, which keeps updated_at timestamps and triggers quiet.

    Before running anything, use the generated SELECT to look at the affected rows, and compare its row count with the number of rows the database reports as updated. Everything runs inside a transaction when the option is on, so you can roll back if the numbers do not match.

    Other useful tools