TurboSQL Guide

UPDATE Statement

Previous  Top  Next


Modifies one or more existing rows in a table.

UPDATE table_reference
SET column_ref = update_atom [, column_ref = update_atom...]
[WHERE predicates]

Description

Use the UPDATE statement to modify one or more column values in one or more existing rows in a table.

Use a table reference in the UPDATE clause to specify the table to receive the data changes.

The SET clause is a comma-separated list of update expressions. Each expression is composed of the name of a column, the assignment operator (=), and the update value (update atom) for that column. The update atoms in any one update expression may be literal values, singleton return values from a subquery, or update atoms modified by functions. Subqueries supplying an update atom for an update expression must return a singleton result set (one row) and return only a single column.

UPDATE salesinfo
SET taxrate = 0.0825
WHERE (state = 'CA')

The optional WHERE clause restricts updates to a subset of rows in the table. If no WHERE clause is specified, all rows in the table are updated using the SET clause update expressions.

See also

INSERT, DELETE