COMPUTER LEARNING CENTER
WWW.HUUKHANG.COM
♦
!=
:
Khaùùc where
CustID!='12';
♦
<>
:
Khaùc where
CustID<>'12';
Caùc pheùp toaùn logic coù theå söû duïng trong conditions
♦
and : Pheùp toaùn "and"
SELECT
*
FROM
tblOrders
Where
Amount!>100000
And
CustID='12';
♦
Or : Pheùp toaùn "or"
SELECT
*
FROM
tblOrderDetails
Where
Amount!>100000
Or
CustID=‘12’;
♦
Not : Pheùp toaùn phuû ñònh (not)
SELECT
*
FROM
tblOrders
where
OrderDate
is
not
null;
♦
Not in : Pheùp toaùn phuû ñònh (not in)
SELECT
*
FROM
tblOrders
where OrderID not in (‘12’,’15’);
♦
Between: Keát quaû thuoäc trong mieàn giaù trò
SELECT
*
FROM
tblOrders
Where Amount between 10
And
500;
♦
Like : Pheùp toaùn so saùnh gaàn gioáng, söû duïng daáu % ñeå theå hieän thay theá baèng kyù töï ñaïi
dieän
SELECT
*
FROM
tblCustomers
where
CustName
like
'%A';
♦
Not Like : Pheùp toaùn phuû ñònh so saùnh gaàn gioáng, söû duïng daáu % ñeå theå hieän thay theá
baèng kyù töï ñaïi dieän
SELECT
*
FROM
tblCustomers
where
CustName
not
like
'%A';
♦
IN : Pheùp toaùn so saùnh trong moät taäp hôïp
SELECT
*
FROM
tblOrders
Where
OrderID
in
('100','200','300');
Ví duï 8-5: Ví duï veà SQL daïng SELECT vaø Where
Giaùo vieân: Phaïm Höõu Khang