SQL UPDATE statement is used to modify the existing records in a table. Which record  is to be update it is decided by a condition. To specify condition, we use WHERE clause. If you used WHERE clause with UPDATE query to update selected records otherwise , all the records would be affected.


The basic syntax of UPDATE query with WHERE clause is as follows:

UPDATE table_name
SET column1 = value1, column2 = value2...., columnN= valueN
WHERE [condition];




The PRODUCT table having the following records:

Following example, which would update ProductName for a Product which ID is 1.


UPDATE PRODUCT SET ProductName='Acer Laptop' where ProductId=1


Now, Product table would have the following records:

Note: You can also update multiple columns at a time to the selected records.



Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

you may also like