Update records
The UPDATE statement is used to update or alter a record that matches a specified condition, which is implemented by constructing a where statement. The statement format is as follows:
Update "TableName"
Set "ColumnName" = "NewValue" [, "nextcolumn" = "newvalue2" ...]
where "ColumnName" OPERATOR "value" [and|or "column" OPERATOR "value"];
[] = optional
Here's an example to illustrate:
Update Phone_book
Set Area_code = 623
where prefix = 979;
The above statement is in the Phone_book table, and the Area_code is set to 623 in the prefix=979 row.
Update Phone_book
Set last_name = ' Smith ', prefix=555, suffix=9292
where last_name = ' Jones ';
And the above statement is in Phone_book, in last_name= ' Jones ' line will last_name set to ' Smith ', prefix is 555, suffix is 9292.
Update employee
Set age = Age+1
where First_name= ' Mary ' and last_name= ' Williams ';
This statement is in the employee table, in the First_name= ' Mary ' and last_name= ' Williams ' line will be age plus 1.
As with each lesson, you should do the following exercises after completing this tutorial:
1 because Jonie Weber has married Bob Williams, it needs to update its last name to Weber-williams.
2 Dirk Smith's birthday is today, so his age should increase by 1.
3 All secretaries are called "Administrative Assistant". So change all the title headings accordingly.
Just do these few exercises, do not be careless.