update (language command)

Description

Changes data in existing rows, either by adding data or by modifying existing data. Use this as a language command.

Syntax

update [[database.]owner.]{table_name | view_name}
set [[[database.]owner.]{table_name.|view_name.}] column_name1 =
{expression1|NULL|(select_statement)} [column_name2 =
{expression2|NULL|(select_statement)}]...
[,[[database.]owner.]{table_name|view_name}]...] [where search_conditions]

Parameters

set

specifies the column name and assigns the new value. The value can be an expression or a null. When more than one column name and value pair are listed, they must be separated by commas.

where

is a standard where clause.

search_conditions

sets the conditions for the rows that are retrieved. A search condition can include column names, constants, joins, the keywords is null, is not null, or, like, and, or any combination of these items.

Examples

Example 1

update authors
 set au_lname = “MacBadden”
 where au_lname = “McBadden”

Usage