A simplified version of the update syntax for updating specified rows with an expression is:
update table_name set column_name = expression where search_conditions
For example, if Reginald Blotchet-Halls decides to change his name, here is how to change his row in the authors table:
update authors set au_lname = "Health", au_fname = "Goodbody" where au_lname = "Blotchet-Halls"
This statement updates a table based on data from another table:
update table_name set column_name = expression from table_name where search_conditions
You can set variables in an update statement with:
update table_name set variable_name = expression where search_conditions
The full syntax for update is:
update [[database.]owner.]{table_name | view_name}
set [[[database.]owner.]{table_name. | view_name.}]
column_name1 =
{expression1 | null | (select_statement)} |
variable_name1 =
{expression1 | null | (select_statement)}
[, column_name2 = {expression2 | null |
(select_statement)}]... |
variable_name2 = {expression1 | null | (select_statement)}
[from [[database.]owner.] {table_name | view_name}
[, [[database.]owner.] {table_name |
view_name}]]...
[where search_conditions]