Translate to Tamil

Offers

Amazon Offers

Offers

AliExpress Offers

Broadcast

Online Income

Wikipedia

Search results

Monday, 2 May 2011

SQL Update


The UPDATE statement is used to update existing records in a table.

SQL UPDATE Syntax

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value

SQL Update Example

The "Custmast" table:

custcode
custname
city
qty
rate
1
Siva
Srivilliputtur
50
70
2
Bala
Sivakasi
30
56
3
Kanna
Madurai
100
200
4
Vijay
Chennai
30
30
5
Kodee
Srivilliputtur
60
30
5
Kodee
Rajapalayam
60
30
Example 1: 
Update CustMast Set City='Virudhunagar' Where custcode=1 

Output :
custcode
custname
city
qty
rate
1
Siva
Virudhunagar
50
70
Example 2:
UPDATE custmast
SET custcode=6
WHERE CustName='Kodee' AND City='Rajapalayam'

Select * from custmast

Output : 

custcode
custname
city
qty
rate
1
Siva
Virudhunagar
50
70
2
Bala
Sivakasi
30
56
3
Kanna
Madurai
100
200
4
Vijay
Chennai
30
30
5
Kodee
Srivilliputtur
60
30
6
Kodee
Rajapalayam
60
30

 Share This Post


No comments:
Write comments

Infolinks

Services

© 2014