UPDATE Statement in SQL
1. Create Table
The UPDATE statement is used to modify data in a database table.
UPDATE Table
The following SQL updates the first Employee (Id = 1) with a new Name and a new City.
UPDATE Employee
SET Name = 'Sonu' , City= 'Haryana'
Where Id = 1;
UPDATE Multiple Records
Before Update
It is the
WHERE
clause that determines how many records will be updated. The following SQL statement will update the Name to "Kishore" for all records where City is "Haryana":
UPDATE Employee
SET Name='Kishore'
WHERE City='Haryana';
0 Comments