UPDATE

Synopsis

UPDATE table_name SET column = expression [, ... ] [ WHERE condition ]

Description

Update selected column values in an existing table.

If the WHERE clause is specified, only matching rows are updated. If no WHERE clause is specified, all rows are updated.

Polars supports ordinary scalar assignments to existing columns. Assignment expressions may refer to the current row values of the target table.

Examples

Update selected rows:

UPDATE orders
SET status = 'OVERDUE', amount = amount + 5
WHERE id = 2;

Update all rows:

UPDATE orders
SET amount = amount + 1;