FlipKart Offer

Translate to Tamil

Amazon Best Offer

AliExpress Offers

Online Income

Friday, 10 December 2010

SQL IN









The IN operator allows you to specify multiple values in a WHERE clause.


SQL IN Syntax 


SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...)

In "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
Sandnes
60
80
5
Kodee
Srivilliputtur
60
30

Example: 1  
SELECT * FROM Persons
WHERE City IN ('Srivilliputtur','Chennai')

custcode
custname
city
qty
rate
1
Siva
Srivilliputtur
50
70
4
Vijay
Chennai
30
30
5
Kodee
Srivilliputtur
60
30

Example: 2  
SELECT * FROM Persons
WHERE City Not IN ('Srivilliputtur','Chennai')

custcode
custname
city
qty
rate
2
Bala
Sivakasi
30
56
3
Kanna
Madurai
100
200
5
Kodee
Sandnes
60
80

 Share This Post


Smilely

Services

© 2014