0% found this document useful (0 votes)
158 views6 pages

SQL Zero To Hero With Mindmap

This document provides examples of common SQL clauses and functions used to query and manipulate data in a database. Key clauses explained include SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, JOINs like INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN. Common functions summarized are AVG(), SUM(), COUNT(), MIN(), MAX(), LIKE(), BETWEEN, IN, ANY, ALL, AND, OR, NOT.

Uploaded by

RUSHIKESH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
158 views6 pages

SQL Zero To Hero With Mindmap

This document provides examples of common SQL clauses and functions used to query and manipulate data in a database. Key clauses explained include SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, JOINs like INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN. Common functions summarized are AVG(), SUM(), COUNT(), MIN(), MAX(), LIKE(), BETWEEN, IN, ANY, ALL, AND, OR, NOT.

Uploaded by

RUSHIKESH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

~LIAS -AS

Gtroup
tte1'1in« J
·Ol2Da? BY e!_!j~ l]
d,t DcSC
nt

SQ
ALIAS AS
fxomRle=:
An Alicu is cna.tcd wtfh ·m · l'11e.1onf,
S€LEcT tolu.mn_n4me f\S aliClS-narne
FROM table .. ncimc~

GtROUP Sy
=) (GttooP sy cotuM tJI
E"Kcirnf?!t:
set~CT column_ nomc CS)
FROM tablt_name
WHERe condih·oo
Gtl?.OUP BY Column_~ls)
ORoei BY colamn_na111c cs>;
~ (H4Vin~ J SELECT' colitmn narwirC.I)
- - · FtoM table name
.£-.a.mple. WHera condition
GcRoUP BY col-."'n-namt 00
HA\'l ll<h Condition
OiD!R 8V tolumn...naM&tl);
➔ fORDeR BY (Ase~ or @RDefl By De~
rht order b~ ~wonl i, UJtd to Sort -f"1.
,.,!tllt -Se~ i1'1 o.sttriid in§ o.- dtsetnt!linJ order
E~nmp.k:
Se LECT colwnni, Columna, •••..
F~oM tciblt-no.mt
ORDE~ B'I coluwnni, tolu.rr,,at,, ..... Asc/DtS~

JOINS
:!J [rtJNeR 'J"OIN ]
'this kc~c.uord Selecfl -that- ho.Ve ma•chin§ VAl.w,
i"' boffi ta.Ya
€-ntmple: Setecr columl\_namces>
-== __. ~RoM hb\ei
:tNN£f101N t'Cll>lct
OM table .column_name= blbtcz. column_ narn,,;
_ _ _ _-.
~ ILeFT 101 NJ "
f-.omp le: SE l ecT t.olllmn_namc C.s)
- = fROM ta.blt.1
LEFT'JOIN tal,k '-
➔ ~ IGtHT!OIN]
ftamp,le : S~lecr cola111n-"6tw1e(s)
... ,=i- =-- FRoM ta~le i
RI Gt MT -JOIN ta.l>le ~
ON taliet.coluthn n4mt =- t:able2. cofumn_rnn,;
-
~ 1-
J: U-L.L_ TI>
_I N]
_____

f!4f!lp~ : SeLecr colurm_!la1u. ts)


F~Otll tlblci
Fu LL ouk.r 10,n ta.I.le a,
Ot-l tab~1.Colulfl\1\Clme.~ ~t2. columnvtoma;
WKett: cond1f:fOI\ -
l=UNCT(ONS

~ jAVGi () I Selecr AV& (c1lurm_hOnW


f-ca.mp~ : FROM ta.W.e_ ncune
WHe re- Condi ~iDn ;

9 JSUM n] St:tecr .SUM(CDlumn.. rw.mc)


FRo M blbl~ no.me.
e~o.mpk = wH~et condition i
I
'=9 fCOUNT o SEtecr CPncb1d :co)
~umol~ ~ FROM Ptod.urb;
"=9 (MIN C>} SELECT Mltl (CotiAmn_nome)
FROM table_ name
Eta.mp~ : wHe Re condition;
➔ (MAX O ] Setecr MA>t(tolumn_nami)
f•o.,!!'p.!£. ~ FROM t:al,lt_narru..
WH,ie conditionj
WHE-Re-
=;, [.L.1 l<E-J =9 {:I: N I
fll.O.tn Pcle ~ f,ll~ ple :
.5tLecr cotumni, cou.mt_,.... .Sctccr column_no.rrw.CS)
FROM ~a.blt. _ name. 1=Ro M t-o.blc_nGme
Wttcl?6 CowmnN Ll~S Pattern WHE-Re colutlW\._namt I'tJ
(volut.1. 1 value~, ....);
=tis~-rw~e:N I ➔ [ANY)
~CLmple ~ E(unplc:
SE.t~cT colu.mn_Mme
5etecrrcolurm_nQmt
~o M tClblt _nan,e.
°'
F~oM to.bt~_name WH~Re cowmn_nama,
WHt Rt COltlm n_no.mc B6TWl:eN t: ~TG.to r ~y
\__SetecT cotu.rnn_~
\J4lut1 AfJD4'o.lu.e2.~ FRo M tclbt e_ no.me
=, \f1ists I SetecT colu.mn_no.meCS)
FROM table-name
ho.111p$ = Wttcee tlisis
SeLecr cotumn_no.mc FROM ta1'le-nam,.
wHcRe condi f:ioo),
~ (AL~j Setecr tlLL column_n4meCs)
fta.lllple! FROM toJie...no.me
- LOHtRG condi~on;
-l. [AN D) St tec T Colurnn1., column a, ....
-, P~OM tttble-no.me
t'M.OJl\p.!£_: WHe~& Condi~onj AWOCo nd iti~ AND Crldltfon3 •. .')
{ot 1 5€.te.CT colurrri 'l, colurtlt'I 2.,.....
~ t1. m le· FtoM f:able_nanie
J P • WHt~E- condioni OT condilion~ orcondihiwl3 •... ;
~( NOT) S€L€CT colu.mn:t., Oll1tmn2., •...
f" \ •PROM tab le_ name
tllllfflf2 e • WH t '1 € f..l OT Con di l-i 00 j

You might also like