Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > UPDATE >

WHERE Clause

The WHERE clause lets you specify search criteria to limit the rows to be updated. If you omit the WHERE clause, every row in the table is updated. For more information, see the WHERE Clause.

The next example uses WHERE and FROM clauses to update three columns (state, zipcode, and phone) in each row of the customer table that has a corresponding entry in a table of new addresses called new_address:

UPDATE customer
   SET (state, zipcode, phone) =
      ((SELECT state, zipcode, phone FROM new_address N
         WHERE N.cust_num = customer.customer_num))
      WHERE customer_num IN
         (SELECT cust_num FROM new_address) 
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]