[Previous] [Contents] [Next]


Updating Data


Data can be updated using a similar syntax to that of the INSERT statement. Consider an example:

UPDATE customer SET email = lower(email);

This replaces the string values of all email attributes with the same string in lowercase. The function lower( ) is one of many functions discussed later in Section 3.9.

The UPDATE statement is also often used with the WHERE clause. For example:

UPDATE customer SET title = 'Dr' WHERE cust_id = 7;

This updates the title attribute of customer #7. Consider a second example:

UPDATE customer SET zipcode = '3001' WHERE city = 'Melbourne';

This updates the zipcode of all rows with a city value Melbourne.


[Previous] [Contents] [Next]