Assigning variables in the set clause  Using the from clause with update

Chapter 7: Adding, Changing, and Deleting Data

Using the where clause with update

The where clause specifies which rows are to be updated. For example, in the unlikely event that Northern California is renamed Pacifica (abbreviated PC) and the people of Oakland vote to change the name of their city to College town, this is the way to update the authors table for all former Oakland residents whose addresses are now out of date:

update authors 
set state = "PC", city = "College Town" 
where state = "CA" and city = "Oakland" 

You must write another statement to change the name of the state for residents of other cities in Northern California.





Copyright © 2005. Sybase Inc. All rights reserved. Using the from clause with update

View this book as PDF