UPDATE

Update rows of a table.

Table of Contents

Synopsis

UPDATE table_ident [ [AS] table_alias ] SET
    { column_ident = expression } [, ...]
  [ WHERE condition ]

Description

UPDATE changes the values of the specified columns in all rows that satisfy the condition. Only the columns to be modified need be mentioned in the SET clause; columns not explicitly modified retain their previous values.

Parameters

table_ident

The identifier (optionally schema-qualified) of an existing table.

table_alias

A substitute name for the target table.

When an alias is provided, it completely hides the actual name of the table. For example, given UPDATE foo AS f, the remainder of the UPDATE statement must refer to this table as f not foo.

column_ident

The name of a column in the table identified by table_ident. Subfields can also be defined by using the subscript notation with square brackets.

expression

An expression to assign to the column.

condition

An expression that returns a value of type boolean. Only rows for which this expression returns true will be updated.