UPDATE statement is used to modify column values for selected rows of a table. WHERE clause is used to select rows of table to be updated and SET clause is used to calculate and update the column values.
UPDATE EMPLOYEES SET MONTHLY_SALARY = 3500.00 WHERE EMPL_NUM = 1562
The above query updates the monthly salary of an employee.
Searched update: In a searched UPDATE, a condition is searched. For every true, the row is updated.
UPDATE EMPLOYEES SET PERKS = 500.00 WHERE PERKS = 200.00
The above query updates perks for employees to $500 who had initial perks of $200.
Update all rows: To update all rows of a table, don’t include a WHERE clause.
UPDATE EMPLOYEES SET PERKS = 1.1 * PERKS
The above query increases the perks of every employee by 10%.