SQL q Spider Notes
SQL q Spider Notes
AY
Op
TRVE D/
>REA DATA
Rt perations Tis
us cROD vefeved
as
PRoP DELETE
MoDIFY UPDATE
|RETRIVE READ
RT
JusECREAT|
opevatiosas severa povon dotobase
we h
systenotiek aindata's store
uyedo Contpine fpmediom| place a isbase Rata
to JtoBase;
Consider
as objet/ knoun is
oortd
-Ayting, Yea
arhas hich
w'stonte non & (o)
n ting vêng Sntty
is Zrtjs
er bet ma oyject anbut nstuing
btes pepertes
tt sheret
opevtes
of desevibes wich foct ata
Quagongoge tucksed
Sal
2024 31-o5-
Pate Base Managnet Sni OBMS) ;
a sotwave olich s used to maintain and
monages the database sohoare Snaink
2-t cons'st of too impertont eatwes |&ynanage
Secun'ky lang
2" Ahorizaton Yi2tor
Relstonal Model;
Relational madel uas de by a dtasientist
Called E-P.codd model then t
folows Ro lotionad
*Avy DBMS oh'ch
beiomes ROBMS (peMRedationad
model
eooms
4
Rules oP
Monegenst
Relaiona Qta Bose of e;
Sluw wuich used to
pBMS
D3
maintain ond honages he fon of tabley
stoved en the
3o RDBMS dato con be
structued Quoylany b ComwI Cate wtdh ROmy
A ue ave using ymau'ntatng
manag ey
P L t ooiysto
Syit Sao3ó
Tpe:JPG
ng
3Sluo4
Datetos
size:
tadata
mened
Lmetatuble
2- Constrou'nt
Byasuing Ta co lum
in Conshvcits ho acol
Note
ata bË- stt detovminey wheh end or tpe f data
stould be entetng into o pavticlav colomn Corl a
Coation:
char
Vavchav var char 2
3ate
4Numbe
s Large objeet
Lschaact Lavge ojert.
L Benory large object
ATA,TP dota shold be ertening
detemines wkich tind a tyge of lochon
t cor)
calumn tor)
calmn amemory
a
partiala
-kenber
charaites
Zavge shject.
e char 'A-2',o-9,.special ehor, Alpho rumevte
’Clhovactes ae must enelosed
i- char (stze)
wtthln a strgle quates
char &s upto 2o0cuar mainmanst
of chartos
The mouimom s2e menos allocatron 1evisne
dt folows faed length ot
used memo Ony Se
Var char r mennar
+n followS ar
Várehav verston ot vorchay
Varehar2 is an opdated(size)4000 ehar too0 cha
Varchav 2 pess vpto
SyntoVorchar
- Csize) we can
An 2
Vevchar 2
ha iY Varchar2 (s'ze )
iy char stze) he marimumn sze o varcha2 &s
char is 2000 y
iiyThe maximum size oË opto 2o0O cha
cha Vaviable langth af
y + followsalloaton.
alocation memog wile be
ivy The Onvead memonymain
vy he onused memoy will be return bak te an memoy'
uastage of memny
the dates
t s used to btore
gntarn Ebte oracl e spo: tomat
dates n an
woe neaol to stove
Oroele fomnate -
-yY 'o- JAN -202+'
3l-pee-24
pP- MOn
9A is used to stove only the numeri ca valuey
Syntax ir Wember (pree's ion, Cseale)
dn Abamber dta type we too argunutsCinput)
* prec's'on, scale.
Preei'sien s mandato
Scale is optionda
ts used to alorate norof digits rauved to store
Pre'sion : st
integer ale preeision is lto 88
* Rang deeimal values wtin the give
store
Sale- Jt is used to
Preuson is -84 to 12
of sale 'o'
* The onge of value ß Scal e is
* The vange
Neumbey (s)i-t qq q a
qqq.q9
(s, ):- t q9qq999
Numbex (3):-t
Nembe
Numbex (3,6): t
A+)%-t " 9oo9q
Numbev
Legeebjets
used to stove
Jt i's tGBof si2e
Opto Ccto R)
large object
charactey phatos, Adio
gntan;
Btore the
Stoe the binagvales of
used to 4 GB size
Upto
et
video docu
i BLOB - Bnog
Synta
yta ReRnition karg,' (OR1)
Rata Manipalaton ong (JML)
C
Qansacton Contral g cTet)
4 Rta Contol Kang. cRet)
5) ato
Rta
data bromte database.
t ts ed breivia the
2- pojechon
3 Seletion
4
Selet to vetriuing the data from ae toable and
Tr 34 is sed
dota om te fable by salectg
2.
Pojton is used to vetriving te
Z
only he olumns
dafautthe alees, ore dita
by
4the calamns are at saleted selected
present in a coleuran also gt
Selecton : slectirg bon
retiving data Gom the talble by
3 st is used to
slema an vecovds
4: doin 3
usd to vetiwing dta Kom the mulhplebles
t is
simulto neousy
rejecten;.
pejeton is used to vetive the data Rom the datalse
Celmne.
bg ony seleeting the Rajetori
SYNTAX
SELECT */rDisTTNe1] colunn Nane/
Bxpreston CA LIAS]
FROM TololeName:
Order Ereeton;
(- FRO M
2-5eLGCT
write a
table
to
Stuelt sply o Stdeit nama preset
otptaf
n
in a shet
Snamesp Snemea San SnamesbmnSname-Au Fom elause
Sname braneh per seleetelause
Selet Sname
Fro m Studet; MECH Snane
2 B
AER
3
D
4
E
UNOER ExGCTION
Asteris's'*
used to display ag Hhe dtgion the table.
S# is
Queny to see talolenames presut intn a dtabase
Select * From tob ;
Studeut tobla,
onte a queg to display aul the details fom the
SeL> select om stceut
to disploy all the dstails Bom he euplee tobl.
Gorite a uay
Select*
Prom Emp;
Owa-Do Disp o8 t.o dotk brom the Dert talbl
Selet
Distnct
Sk is used to emnove dupliate co) Yepeted values in
a vesu table (o) olptable -
" e aannot pas dis-tinct as an second argumeect.
on the dstinct clas
we joas muttiple column name Valesata ol
Yemove 'Combinat'on of the
of t e vecords , aouch
dupli aate[Corb of tte values och are
dupieote getremoved]
the e ne presest n the Stuoat
table Shdet dee
otn
stn Select distict Snane.
Rrom studeut
STD Sname Branc Per Outpto
seleetelause.
Rhea Cse Sname
Rhe a
2 Sna
Rhea
Hinata Gee Jmitoehe Rriga
4
Rhea cse 41 Winate hitecle
6 ||-Rheer inata
|viva
Uneler Sueeution virat
a studest +abl
dile bneh preseut in
uite a
seleetclase.
Select distict Brane h
forn Sudat ewrte a queg to dspla
Braneh Pres tn a
4{
use stto
balt
coul ue
be hot Sip' Rron
Sal igue Sleet
Uniqhe obSales distinet Sleet Gey
salavies i4ob
dspla to
quey a teLori
le! emp in
Som
Slar'es Distinct selet Gey
table.? efp salanies
in die display yuegto
ovite
aramet"
andistinet
as pas
dsplajsntCauld lote it
snprestor sèrg mis error
piurlqo studeti Rem
avil Sname dstnct sd. Seleet
cse41
Cse
Mech studet Prom
kse9 per eorCsee Percast Brondh. Distct select ueny
Pew
tabstudet
le ina banehPerce.
rexet die dis to Lorte
a
wivat
eiu'e
tHnga.
GCe
CsE
Hitaehe
Priga studlet From
melh
Cs-& Rheo BranCh name, Dtstr'ct Selet 6lueny-
Branch Sname
be sta baneh
ain name2 dil di'splay to ovitea
Any stnts
stnks olich,
hicn give vesult is known 3a Syp
xySxprusion is a Gomb o Boporands alarg 3t2 = s
opevatore Buprestor
3+2 :S (ov (S2)>npreion
Operands opevonds
oprate
operand may'be a lm name ca9 vl
predekned Symbols usedto e torn
toperato oia
Amad
Am sal Br all
br the Eployece's .
onite oquay todisploy
selectysal2
iob holf tem sal fov al the e
oOTD nahae,
Slect enae job Sal /G
anals l
Nemeand
enae Satt sa
Sel et
all the ep.
with onnual sal tor
Selectep*,Sal12
b s d vallt e eu
Yeolue
amus oith a
eeratys in sal:
I· Avthemef'e Opevtors ;- (+,*
2 Conaalenot'on Opevato;- (I1)
3" Comparisioh Operotori l=, I= (or)e >)
4 .Relattonad operotovi- (>1<,>:, e)
5. Logied operator;- (ANO.
ANO, OR NoT )
/5 No T
LLkE
NoT LkE)
8
2-Concatenation Opertor i:
+ t is csed to oinihe given Stngs (11)
is 1
*The Shrbol of concaenacton ope (s
ENAMEI| |.Uke
ou
E- Select MR, EName Select
EMP3
From
Fro m EMP
ith MR 4 sal Sffi it
wT D The hame pvefx
- MR. | |ENAME )ENAMe
addiion opevtor
opeyadtor is
get sttohed
+0R oneothe conoidion
B A+B
A
Conoli F
-A+6.
Cord B
AwaTO
In
oQ:T-D dept TURNED Blalcs
yita
hameSal opuotocn*dna an
Where fromEmpSelect names
LSOOARD
No
where FromSeleet 3oo0 opevot
rekuns
stsRed. tortue qoator
lanesal,E Job o of Column-name RHS.
304020 Deptno
or
TN
26
Smployee 36
Sal
(Deptno
'NSnankANAGER, Can is
woaandÀNALYSt)
Sl,
I
Deptno who
30 20 30 sinilau's 2-8¬TwEEN
(3 SiameS> |
Select accest
o00 whoave ove exprevsion
Sooo) where
aF ooteing multiple t% NoT lN2
Snp ANO
AND iooking Beptno IN one yals
JOG presidet Dept (Vi, of vales
opeator. NoT
no daptno IN V the
seRD KE
PrEsI0E MANA s aue torn
TN GER
(10,20,3o) )
SMittzSoo
2o
wT:p detais ot Snup who ave he'vad baring tthe Eing goo
colunnname /Epresion NoT TN (ViVVg --Vn;
Select
details of mployee' ycept eoho ave oosbing in deptno io From
where Emp
hieredate between '31-dee- g
Select f the enp are gettng sal in the range
fom Smp Name k sal of emp
of loo to 3600
where deptno oT | N(oi30); Select ename, Sal
JQ-T D name &sal of Enp he emp name ts smith expt Tyoye From Emp
PRESipEWT.
woring as a mnanager or wheve Sal between joo0 to AND 3600
are
Select Snamei al 0QTD detoib of enup along votth anwal sal the erplotoes
eaYng sal between os |25o to Sooo
rom Emp TNC'MANA GER, ReestpeNT)
where Sname STH ANO JoR NoT
ercept dept20
om(00r Select 4
Detuls of Emp Aoad a c 1324 or ANALYST
From Smp Between 125
where Sal 12
Select
Frorm Smp Deptno (to,zo) NoT BETWEEN
CcoRE.'ANALYst) AND NoTIN O l s l ,
oheve Job TN Consist of (oy *J4 is s similar to Betwcen instead of selecting
BETWEE N OPE RAToR;
ethe and Same
consist ange thenYange veject's the values.
we wl
*Lohen theve is a vonge of values Columnname lErpeslon NoT 8Etween Lowerkange ANO Higherkange
operator (starfig Volue ond Erding le) (RN0aTo hieri dets of Smp oxacupt coho aye heire d
dauring the year 8+
hieredote Not Beteen ot-JAN- 8t ANO 3)-hcr-22!
Select Frmn So wheve
Jt uosks iadtdi including the'gvers vages are getng Sal is <looo k >3000
uJe coulok not tnter dhonge 7hen Yohges Q oaTD Salaries of Emp oho
colomnnome/ Bnpresio h BETOGE NStoting Range Ano Select Sl From Smp oheve Sal NoT betoeen ibo0 AND
300o
Endang Rage, Q waTD Detail of emp ho are heired duving 1e yeor 82 Exenptuoning
SaTo D.romes of mp ho ove get ting &a >isoo and <lyooo: Sales mam or maruger. ol-Jan g2 and
gaK ASE heire d Yeoct Betueen
Select Ename Select * om Emp tohere
From g1-Dec- 82 NoTTN
oheve Sol Between 150| AND 3444