typestar

UPDATE with a filter in SQL

UPDATE rewrites columns in the rows WHERE matches — all of them if you forget.

UPDATE orders
SET
    status = 'shipped',
    shipped_at = CURRENT_TIMESTAMP,
    attempts = attempts + 1
WHERE status = 'paid'
  AND placed_at < '2026-07-01';

How it works

  1. SET takes one assignment per column, comma separated.
  2. The WHERE clause is what keeps the change scoped.
  3. An expression on the right can read the column's old value.

Keywords and builtins used here

The run, in numbers

Lines
7
Characters to type
145
Tokens
25
Three-star pace
80 tpm

At the three-star pace of 80 tokens a minute, this run takes about 19 seconds.

Type this snippet

Step 6 of 8 in Tables & rows, step 19 of 23 in Language basics.

← Previous Next →