TurboSQL Guide

UPDATE Statement

Previous  Top  Next

Modifies one or more existing rows in a table.

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


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 for that 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.

By using a subquery the values can also be taken from a different table:

UPDATE salesinfo
SET taxrate = (SELECT newesttaxrate FROM [globals])

See also