UPDATE Keyword
The Update keyword is used to update the values of an existing row in a table.
The SET keyword is used with the Update command to set new values for a particular column.
Syntax
UPDATE <TABLE_NAME>
SET <COLUMN_NAME1> = <NEW_VALUE>, <COLUMN_NAME2> = <NEW_VALUE>, <COLUMN_NAME_N> = <NEW_VALUE>
OR
UPDATE <TABLE_NAME>
SET <COLUMN_NAME1> = <NEW_VALUE>, <COLUMN_NAME2> = <NEW_VALUE>, <COLUMN_NAME_N> = <NEW_VALUE>
WHERE <CONDITION>
Example 1
UPDATE Employee
SET Emp_Salary = Emp_Salary + 1000, Emp_Country = 'India'
Example 2
UPDATE Employee
SET Emp_Salary = Emp_Salary + 1000, Emp_Country = 'India'
WHERE Emp_ID = 5
In Example 1, we have not given any condition, so it updates all rows of tables, and in Example 2, we give a condition, so it only updates those records that match the condition.
I recommend always using conditions in the update command, and before updating any data, please use the select command and check how many records will be affected by the update command. so you have an idea that these records will update.
Summary
The Update keyword is used to edit the existing records of a table.