Tell Me
 

Using the Update Statement

Previous previous|next Next Page

The syntax of an UPDATE statement is shown in the graphic:

table_name in the UPDATE statement specifies the name of the table whose rows you want to update.

 

Syntax

UPDATE table_name
SET col1 = val1
[,... coln = valn ]
[WHERE condition ];

The SET clause identifies the names of the columns that receive new values. Each value in the SET clause specifies the corresponding value for the column. This can be a simple value, an expression, or a subquery.

You typically use the table's PRIMARY KEY column to identify a single row. Using a nonunique column causes several rows to be updated. For example, identifying rows in the EMPLOYEES table by the DEPARTMENT ID value causes all the employees in that department to be updated.