SQL UPDATE Statement

Introduction

SQL UPDATE statement is used to modify the data already present in the database.

Syntax:
UPDATE table_name
SET Column1= value1, Cloumn2 = value2, column3 = value3.....
WHERE [Condition];

Example : Query using UPDATE statement.
Consider the following table titled as 'Clients'

Client_IDLast_NameFirst_NameContactCountry
1ThomasAlex2400000USA
2CruiseMartin5600000USA
3PanditPrajaktanullIndia

1. Write a query to update contact information of a particular row where condition is given as, client id = 3.

UPDATE Clients
SET Contact = 34542892
WHERE Client_ID = 3 AND LAST_Name = 'Pandit';

The result is shown in the following table.   

Client_IDLast_NameFirst_NameContactCountry
1ThomasAlex2400000USA
2CruiseMartin5600000USA
3PanditPrajakta34542892India

2. Write a query to perform update operation on multiple fields from given table (titled as Clients) below.

Client_IDLast_NameFirst_NameContactCountry
1ThomasAlex2400000USA
2CruiseMartin5600000USA
3PanditPrajakta34542892India

UPDATE Clients
SET LAST_Name = 'Brown', First_name = 'Albert', Contact = 923849, Country = 'UK'
WHERE Client_ID = 3;

The result is shown in the following table.   
Client_IDLast_NameFirst_NameContactCountry
1ThomasAlex2400000USA
2CruiseMartin5600000USA
3BrownAlbert923849UK