SQL SORT NOTES
The S@L yeserved words and characters ave called operators,
whith ave usted With a WHERE clause in @ ft query.
[ere Name clats __|owwision | cry
10} VYadnytth toth 4 Pune
102 om loth c Mumbai
103 Sani} 10th D Pune
[ey Ronan Jorn Bb Pune
[les Atul tor A Deni |
| Joe Yadav loth L e [Mumbai
Student Informoarion Fable.
| LS
1. _AND OPERATOR
"ne S@L PND operator }$ used With tne Where clause jn
the £92 Muery - AND operaror IN $42 yerurns enly gnose
records wonrtch Satisty both the conditions In fhe £42 guery.
Continue —>
| aru roman (ommerra)—_
Guery 2
2 ” 5 i
Sevecr *FRon gry dent Keke alame = Yadav “MriD City > ‘nfumbai"s
Ontput >
Koli-alo NAME CINsS Diusion city
1oé Yadav Jom c | Mumbai
fn above example rhe sg) statement returns only one value cause
in given g¢osle and thelr iy only one Stident Who has name
"Yadav" f he belongs 4o mumbai.
Note: Thue if all the conditions ceparared by AND Is True.
. R 1b $< PR (LI KEDIAL,
= ‘ OR OPERATOR. OPERATO ALOT ES ileRy (TELEGRAM).
+ Phis operator disploys rhe yewrds yohere either one of the
conditions londitionl and Condition? evaluates 7o True.
« The OR operator elispleys @ yewrd if any of the conditions
Leparated by OR is Tyue-
Query >
SELECT * PROM student WERE Division 2"C "OR City = “petri”
Ovtput>
Roll-slo_| lame Class Dison city.
jor om [oth C3 Mumbai
105" aque loth a Deni
106 Yadav loth c Numbai
Continue —>
LAruceomon(erniEDIN)- ye—<—
Jn qne above example phe <9! ttaterjent returns phree values.
Cause Given qoble have #wWo Sudentt tho belongs fo C Division
one ts From Delhi.
Alte: TRUE iF any of phe conditions separated by OR it TRve.
3. Between! OPERATOR:
Poe Between operator In fa. shows pre record within the vange
mentioned In the SOL query - The operator operttes on qe
numbers, characters, and dare /¢ime operands.
Query >
evecT * EKO Student WHERE Roll_nlo BETWEEN Jo2 HxD 10uS
wm PR [ LINKED Ial ).
Outpur>
Zoltato | alame Class Oinsion city.
for Om loth a Mumbai |
103 JSQnil joth dD Pune
104 Renan jo B Pune.__|
In phe above example ghe £4] >
Query :
ELECT * PROM Grudent WIMERE CITY LiKe LUy.)s
Aruc Komer [t
Output: Alor ES GALLERY (TE ERAT,
[eon lo Alame class Division! ary.
| yor fadnyesh foth Pane
foe on toh | rfumbal
103 Sant) lorh Pune
toy _|_ Renan Joth Pune
106 Yadav Jor Mumba
Bh Firsr Query yerurns all alame of Students starting from Y.
In second Gyample yeturnfall the records t2ho have setond
Letter 15 UV: ¢ren any Combination oF faster.
5-_Alot OPERATOR _
Alor operator jn SGL thowS those vetordt from che foble
woneve he criteria hs not-met. Alot operator jr used with
Where Clause in a SelecT query
Query :
Seuccr * From Students Were Nol city = “Mumbai”;
Alame Class [ Dinsion! a
i Yadnyesh
Lahil
Kohan
erul eumak (LINKEDIA ).>
in the above example yerurns Phose Ludent yetordst fhoste tno
are not from mumbal. Pris query athows yewords of frudents
Aaving city orher pnan Mumbai.
6+_IN OPERATOR
kshen we want 7° chek for one oY Moye than One Value in
@ Single JGL ery » 49e use IN Operator ith the WHERE
clause ing f€teécr guery-
16 Keo MAR ( LINKEDIN,
Oe Nee a —| i
Query :
Levecr ¥ Feo Srusents wunere city jl "Detni" Pune");
Outpur:
[gon-alo | Name Class Dwsion | City.
Jo} Vadnyes? Jot A | Fane
103 Sari) jor” Dd Fane
104 fonan ton & Pune
a
[ tos Atul fot Deini
In the above example yerurn prose ffudent yewrdsS ¢hose who
are From Delni and pune. other dhdent vill nor displayed: