Updating data in a table
With an UPDATE statement, you can change a single row in a table, a set of rows that share one or more characteris- tics, or all the rows in the table. Here’s the generalized syntax:
UPDATE table_name
SET column_1 = expression_1, column_2 = expression_2,
..., column_n = expression_n
[WHERE predicates] ;
Example
UPDATE PRODUCT
SET Cost = 22.00
WHERE Name = 'Bike helmet' ;
UPDATE PRODUCT
SET Cost = 22.00
WHERE ProductID = 1664 ;
UPDATE PRODUCT
SET Category = 'Headgear'
WHERE Category = 'Helmets' ;
UPDATE PRODUCT
SET Category = 'Accessories'
WHERE Category = 'Headgear' OR Category = 'Gloves' ;
The optional WHERE clause (square brackets indicate that the WHERE clause is optional) specifies which rows the update applies to. If there is no WHERE clause, the update is applied to all rows in the table.
UPDATE PRODUCT
SET Category = 'Active-wear' ;