Skip to main content

Posts

Showing posts with the label UPDATE Statement

The UPDATE Statement

The UPDATE statement modifies the contents of the existing records. To use it, name the table needing to  be updated, provide a SET clause that lists one or more column value assignments, and optionally specify a  WHERE clause that identifies which records to update. The Update statement uses the following general  syntax; UPDATE table_name SET column=expression(s) WHERE condition [options]; For example, to update the Country table by doubling the Population column for every country, the  following statement would be used; mysql> UPDATE Country            -> SET Population = Population * 2; Query OK, 232 rows affected, 1 warning (#.## sec) Rows matched: 239 Changed: 232 Warnings: 1 Note: The above statement returns a warning and completes the update for only most of the rows, but not  all. This is because some of the updated numbers exceed the number of characters allowed for that column. The effects of column assignments made by an UPDATE are subje