UPDATE command is used to change or modify data values in a table.
The verb update in SQL is used to either update:
Ø All the rows from a table
Ø A select set of rows from a table
Updating All Rows
The UPDATE statement updates columns in the existing table’s rows with new values. The SET clause indicates which column data should be modified and the new values that they should hold. The WHERE clause, if given, specifies which rows should be updated. Otherwise, all table rows are updated.
= , =
Update the address details by changing its city name to Bombay
UPDATE ADDR_DTLS SET City =’Bombay’;
12 rows updated.
Updating Records Conditionally
Update the branch details by changing the Vile Parle (HO) to head office.
UPDATE BRANCH_MSTR SET NAME.=’Head Office’ WHERE NAME = ‘Vile Parle (HO)’;
1 row updated.