The UPDATE statement is used to modify/update the existing record in table.
Syntax:
UPDATE table_name
SET column1 = value, ....
WHERE condition;
DEMO DATABASE:
Roll_NO | Name | Total_Marks | Phone_Number |
1 | Arun | NULL | NULL |
2 | Rahul | 68 | 2147483647 |
Example: To update the marks and phone number of Arun in table students.
UPDATE students
SET Total_Marks = 84, Phone_Number = 12345
WHERE Name = 'Arun';
The updated record of Arun is as follows:
Roll_NO | Name | Total_Marks | Phone_Number |
1 | Arun | 84 | 12345 |
2 | Rahul | 68 | 2147483647 |