UPDATE

The UPDATE statement changes the values of specified existing columns in rows of a table. You can update a table only if you created the table, or are specifically authorized to update the table. For information about authorization, see GRANT.

The UPDATE statement consists of three parts:

  1. UPDATE specifies the table to update.
  2. SET specifies the column to update and the new value to place in the table.
  3. WHERE specifies which row to update.

The following example updates table PERS for employee 250: It changes job to Sales and increases salary by 15%.

UPDATE PERS
SET JOB='SALES', SALARY=SALARY * 1.15 
WHERE ID = 250

An easy way to create an UPDATE query is by using the DRAW command with the option, TYPE=UPDATE.

You can use a single UPDATE statement to update more than one row in a table, as shown in the first of the following examples, or to update all rows for a column (when the WHERE clause is omitted).

Examples:

[ Previous Page | Next Page | Contents | Index ]