clAsSMAte
Date
Page
FLsaL O7 hoUrs
ADA PA
TSSM's
PADMABHOOSHAN VASANTDADA PATIL INSTITUTE OF
TECHNOLOGY, %\PVPIT,
BAVDHAN, PUNE-21. PUNE
SANCU
AY 2024 -25
Sem-1
Department:Computer Science &Engineering (Data Scienee)
Subject Teacher: Prof. Aeman Patel
Subject:- Database Management System
Class:-S.E
Unit No:-2
Name of Unit: SQL and PLISQL
Course Outcome:
Implement database queries using database languages
Books:
Silberschatz A., Korth H., Sudarshan S., "Database System Concepts", McGravw Hill
Publishers, ISBN 0-07- 120413-X, 6th edition S. K. Singh, Database Systems:
Concepts, Design and Application, Pearson Publication, ISBN- 978-81-317-6092-5
2 CJDate, "An Introduction to Database Systems",
3
Addison-Wesley, ISBN: 0201 144719
"The Definitive Guide to MongoDB", David Hows, Peter
Apress, Second Edition. Membrey, Eelco Plugge, Tim Havk.
classMate
Date
Page
ches t0 deal With R.DBMS
Specaic pog lang sequite
Cogish lang
auo ime
Exzlai hat ot
Hou to do) r
Specigy ouoHraiut s
zlcondlton)
qlaated ar
phivYlegea. Cas be qlaated or deoied
Acet
OPesates so evesa roup ch table
Adve
create, delete or wodity table Structure
Rer Can
be cleyined,.
Coutrol the atobase(System Security ,authocat
an)
asert or update the datab as
taoy ct0 (easo Uodehetand
Coding requred
Aote
iut
leogth Voscues
Va
length ixed Aore Caas
type data
Col the to
ign tobaue utable creatiug wwe
(fieldo)
ftuple)
(relation) table foruat
s Cudata -the Siorc we SAL
iesao:
Page
Date
clAsSMAte
Date
Page
Ratabaoe lang
To
create tarat Comnit
A(tes UPdate Reuore Rollback
rop delte -Saxepaiak
ODCate.
Reoae
Select i*from tb-wae
înst fto tb-naue values
K Beete rom th-naMe.;
delete from tb-naM Whese Cosd eimt
(o|-Wawe = vale,
Opclate. tb nauue Set whese
clasSMate
pate
Page
Vleu s a wiHla table.
8t coutaino raus caL uot Rire a rea
table
Vieu are? fiel frou
or wore eal tab leo o datcbae.
Create theiVieuo
ve-naue As Pelect Col1_col2
tbDae ushese
Sa Opdarig the eo
Cas he pdated with Create or
rcplace
stmt
Create or replace as Uiei-0ame. ts
Prom th-naue wbese
alassMAte
Date
Page
crap
Vieuoae
Date
Page
&fs a to0L Osed to quiciy denity row
Specltic Col, atues
Oh these is Do odexea the sqL
lbave to cBart n h the fist ow then
the entre table
ibgh the
iscouehs elevat fouss
Tmproues the speo e data (etrieg al
ft voses by cre coiog a
Seplare data Sirucore
thad prauaes poikohs tbe row io a
table,
creatio9
Create odex lodex
ootb.Coomo;
ndex nae tb Dauc
Crease odex
dx-produc-jd Sales (psaut -
ndexes
) 0oique Podex enoures
the l
t0e iodexed Col. are
clasSMAte
Date
Page
ceate ofque. iodea
Ceolmae) Rudek-uaue 00tboae
udex
Pt Cas be euoved by drop
drop odex Rnde. uaue
Allow uS to peshorns algb apeccfey
auodgHwol or ore.fablRS s ten
clas Mate
Date
SAL Set Opctationy:
Vsed to Coubiue tuO or ofea Squ Strt
Combine tHe eerset
resuF
Col ust be Nae frau displa
Saue Ro both tb present
eliginarea dupiicate
D0 dupiCates
arrage data
EibutRoIstthesee
qe
tber
data aopiicate.data. query
fYrst
Nauie
Naye
Tack
2 TocKson
4
TacKson Stephan
Sauid
ctersect wihuo
A
A
clAsSMAte
Date
Page
Celcct Arst Coneleet e from Be cordi
Name
1
Jack
Harry
JacKso0
4
Stephas .
hfenAL:
first niana select From Secondi
Ans
AJaue
2
taliy
Tackson
Jackson
cdAsSMate
Date
Page
tte[Sect
Qlect t frou frst futereet celeet * fro
Ans:
Oau
Mings:
Setect
Aos:
1 ack
2
ttarry
from selond from
ame
4 Chephan
Dav
clAsSMate
Page
rcui transacion ContrOl lang
CóntroL thé thansaction h:database
Commit
Roil back
Savepatut
Commit:
SfudentF
Qde
Sesves
teupo.
Comnit
t0 pesw Rtore tbe dato u Owe
Qesves table
Ahter. each am queiy ao
ag a o Commt
eKeLuted that perjorm Comnit opes
RelbacK Ctep bacK.
u Comnyt yo0r table fheg chango
Date
Page
More, reCord
add. 0ue or,
doo't (omoit) TUst
table then
olback awt
Commttd
Savepoiuti
wl Save 4Pi1 particuler pojus
We Car rolback wth Save
pofut
naue best
1
Save poft A
4
Mavwe best
1
2
Want
dicplay re cord freu 1 o
Cans Wote
Yol bacr
Savepoit
classMate
Date
Page.
Sawe for
eKeete the
But
Caepoiut
4o from (aot Sepojt
previaua
+Where
aroupb
baviog
Dbese? Wre. Uh uatche
the record. those
select frouA p where Cuod^
frou eeuup
2 Qroup by: basis a simiar
fom a rbup on the data
data9 prode
ESal
eale
2 HR
|
20000
2200o
Sale
HR
prodor
7 He
CIASSMAte
Date
Page
Sales
HR
prodoct
(oUt(*)
Oname
Sales
HR
Prodvct 1
2 bere S
TICCOO qoup by Dame
Pon
Swalest yaue
Select doame, Max(e Sa) Waxc)
m ocup by
donme Somc) +0tal Sum
Valve
celec doamC , Sumcsa Select min (oi- ame) fror
tb-nae
classMate
Date
Page
adway work wth aoup by dalause
Yaluiafe aster Group
doame
13
selei doáneCëuntC) fom'emp bavpg
) = 2 qroup by doame
Cauntc*
eS 3000O
SAL fo0chion
Siogle row
-’Lowesi d'cplay in lowes lase
Selet towe(lo1. u a ) Fromtb-aue:
Üppe:
select Op pe (col-uaue) rom tb-nawe;
displany length of data
Concat: werge two
2elet Concat ( Col-uwe, loluae) from
(oobes)
Ceil Cves UpPe rOUNd-off Value. ohetues ahtes
deia ts eyreate HaayS ornot
Select ceil
Cive Lowes
Vaue
3elee
truncate: qive 4t decimal
select truncate (
aives
digit);
Vae
Uppes
(ower
Seiect ceii(22-3) 23
Select Ceil( 22-4) 23
SelecFfoor (( 22-9)';
322
Gelect Ploor (2gdy) 2 2
22
elAsSMAte
Date
Page
SeLect fouNd (22-9)
22
Select rOUNd çe2-4),
929
sele' tronate ( 22-967, 1).
Suect trunCate (22-361, 0) 22
ett CQuupotisan;
are Osed to loupase .tu
two eues
OPchasor Brseipn'en
Operasor cuk ie the valu
ase veqval
Sql nt equa. opes atas o l .
e the Valueo
opehabds ase et, equal
cdas Mite
Date
Page
Emp Dept
Nhsted Qucy eid
9ame dd
elbi
Ma
2 pune
leiect war (sa) Fromemp chd D3
B elhi
Ep-nawe ho is tatiy D4
wMar Sala. PUDe
Qelect ename From emp where mbau
Cal celet war(sal) Aro) 6
1
Se tond bige Saday Ename
ept
Ra 10000
Select uasCsal) rorm emp where 2 Aot MRKS
Ravi S0000
4 40G00
S
SOL TOio. Osed do Combiue data
AOTe tales based " Cowwmon
Toos Join
Rigud qoin
fol goin
classmate
Date
Page
fudgoi
Quesy
gesect from. tb-0ame. 0er noro tb-na9e- 2
tb- nae" coloame = tb:name.Colnawe
1ef+ goi
fougois
+CROSs TorOi
ut prodee Cartesion
elect from tb-name cross goin tb