DB
SQL reference

UPDATE and DELETE

Mutate or remove current rows from keyed tables.

UPDATE and DELETE operate on keyed current state. Append tables are immutable through these statements.

Update

UPDATE balances
SET balance = balance + 25,
    updated_at = cast('2026-07-09 14:30:00.000000', 'DateTime64(6)')
WHERE address = 'alice' AND asset = 'USD';

Every assignment expression reads the row as it existed before that update. Assignments in the same statement do not observe one another's newly computed values.

A predicate may match more than one key:

UPDATE balances
SET balance = 0
WHERE asset = 'TEST';

Delete

DELETE FROM balances
WHERE address = 'alice' AND asset = 'USD';

Deletion removes the current keyed row. It participates in the same statement visibility and durability machinery as other committed mutations.

Restrictions

  • The target must be a keyed table.
  • Subqueries are not supported in UPDATE assignments, UPDATE ... WHERE, or DELETE ... WHERE.
  • Schema and type checks occur before the mutation is published.
  • There is no RETURNING contract in the current surface.
  • There is no multi-statement transaction around a sequence of mutations.

For append-only correction workflows, write a new event and resolve current state in a keyed projection or query rather than attempting in-place mutation.

On this page