Professional Documents
Culture Documents
Date:
2MAL
SEMESTER
ROLL NO 196EC0GO
ibp
PAPER CODE: CEN-YO5
DBMS
Q1a)
Hienanchial NetoorR Relaienal
Stnuchuneol dataAdatabaae model|A datababe madad
Oraaniged in aree allous mulhplk to manaqe data b
Jik mada eCords h be Huples grsLped into
linRed ta thu sama helationsCtabls)
Owna ilu
Arranaesdata in a Organizes daBa inAanoedata in
ree Similan structuzea araph Structinl tabls
Rapresent ona to mmny Repreent"manu t epaent bath"ona
helatienship mnn telaionship. man and many
to manelahonships
DHHhaut to acess data Easien to aces Easien fo access
data data
less i b Eleiblu Fliblu
Relationship Example
TOr examplL,in a banR database a
COSTOMER_MASTER tablu stores Cubtomen data Lol
0 pHmany Ruy Column named CUSTOMER ID E alaa
`totes OUstomen_data in an AccoUNTS MASTER tabla,-
Lihich helds inlamahien about vanlews banR accounts_
Injomaie,a Cottesponding COSTOMER ID A Coumn
mist be insented in the AccOUNT MASTER tabl,
lengn.cng Ouistin9 Customen TDs aom the
COSTONER MASTEX tablu Tn this ase, the
ACcotUNS MASTER tabluA CUSTOMER TD Celums is
Qarelon Ruy that eleaenes a celumn Louth hz
SamL nam in thu CUstorMES MASIES fable lhs
S Qn e0mpla a elahianohip beteen. thL tuo
tabls
Page No.
Date
Koqram
. data depen.dencyChangesIn pr0arams
heajuing Changes fo the data
lack leziblity
Poar Secumty
ack Datd shainga
tobdort-2
vin omdih
Page No.
Date
numben
Aystem OOtRS Lwellwhen tha
lh i l uoRS
lems ta be torecl is Amall Tt even
au lanqe-
Qlte adLauately when dtheha
item and we haMe onlu to stpre
mben_ o
una
nd rettieihe hem hotoeMeN thi
Sysem
Studantt Daaisda BoRinfp dat ss hat dt AtaunitYo da
Traditional ilh Atorage mathod Jor univensity
Management Sstem
Page No.
Date
Chaznaclousti.C
I6aqroup 0 ies &ating_clata oanorganisatien
och i is lndpenden~ jom oni arothon
tach JlL is alltd a lat fil
tach i l ontained and p1ocessed injormatian Jor
On bpeclc LnchonAuch as accaunhng a
inventor
n s Anë dosLDed by daing Proqramb wrien in
PproaamoMhq lanquiagrs c h as COBOL, C,Cat
QRa)
Main ontity scs aLAhudunt, ouAce COLUse-Cnun4
and insuctor
The cnhty &tt cOUIse-Oening 1s a a k
Cntiy St dpendent on coUnce
tinn Seendroom
n ame)
tabuby tovse
rouinPrepeauiSI te
ounse
maunconce
Cudits)
Page No.
Date
h 4mauzathonApecdalisatian huerahchyJorl
duimoto ehlcluCoApanu an be Qiven by
ilvz
Wehicle n idzrsdoa
Cemmeacial
vehidle to
nate
maz- uny vehicle
Passengeas tozadte
CemmeoiaL Nen-ommexial
vehicle Jehiele
a \LS
ype
model,sales-o nate and kales velume aa attnih1tes
necessayn thavehicles all upe
Cemmea.cia vebiclas atinat Cemmeadial-vehiclo-taz
and each kind o ommencial uehicle has a passenge
C0nyung capacih Apecilied Jen t Seme tupes o
nen-hmenoial vehielesattnact Luxuz vehicle tar
Cank alonu an be eena types AULch as_spats-Can
Bedan, 9agon, ethence by thL Qtribute ype
Page N0.
Date
Since_th ao genanalisation-Apeciali.satio
hiaanchy has à condition-duined dusian
Constrou.nt membenship in tha lotoen lundd
enity-Ak is aLaluwated enth bass o
whetha ar net an eniy saihes
an
eLplicit Conditia Opredicatr Uben-duind
Aouoeaduel enhty uts Coa Commencial
whidu an not Constrained hya
membership condition rathen enities aL
assigned Bo aqLen Set
bidv
loideyL
nirowe-to
unsate1
Lo
disdis
Jabo
id sy- Le9090
db.c9
2r910ton
Loiorwvile-1
Page No.
Date
DBMS
SupplienProduct
SL PL
$ P2
S2
$3 P3
Lonsume2 Produck
C P
CL P2
C3 P3
Supplien Consum
S C
62 CL
$3 C3
Explanahien
labl & 1labl 3 and Tabl H whon joined uield
dhe Onainal tablu Clablu 1)-Hence ioin dipendana
ists in lablu 1dhmutore table 1 iS net in 5NE
Ond RINE Houueyn Tabl 2,tablu 3 and tabl
4aistuing SNE as tt has no mutvallled dependendy4
ond Cannst be dLompased uzthen
Page No.
Date:
(onsidenJellaning exampla
Pizza Delivory Penmutations3
Restaurant Piz2a Vaichy Delivey Ara
AL Pizza Tck (up Spping field
AL Piz2 a uck uw ShilhyilL
PL Pizzoa Thick Cnwt Coptal it
AL Piz2a Stutted Crust SPHA fteld
AL Pizz0 SHAed Cnet Shilbyvil
AL Piz7 d Stuped Caust pifal uty
Elil Pi>za Thin Cnxpt Caprtal GH
Hi Pima Sthued Cuut aprted C
Op Pizza hich Chuwst Sphnatiel
Op Pizz0 Thiuk helbyril
Op izz0 hin Clut phins tield
Op Pizz0 lhin Ous Shalbauil
Page No.
Date:
L)SELECT Caid
FROM Catalog C
WHERE NOT EXISS CSELECT P-pid
FROM Parts P
WHERE CPcelor-red'OR Pcelaygreen
ANDCNOT EXISIS.CSELECT CLSid
FROM Catalo C
WhERE CLsid=Csid
ANDCLpid =Ppid )_
i )SELECT CSid
ERO Cotaloa C
WHERE CNOT EXISISSELECT pid
EROM Ponts P
WHERE P celor=ed'AND
CNOT EXISIS (SELECT C sid
FROM Cataloa C
WHERE CLsid =Csic
AND CLpid =P pid)))L
ORCNOT EMSTS (SELECT Pl:pidL
ROM Ponts Pl
WHERE P.color= *Arcen AND
(NOT EXISS (SAECT O-sld
RC Cactalog C2
WHERE C Sid - C:sid AND
sid=PA pid))))
Page No.
Date:
H Cc)
1) HAVING
Ih HAVING clauAL in used in ths SELECT Staemont
tn_spcah ten_conduhons or a arouup o reUs
OY aaae.aates
Examplu SELECL
Otdp Numben
SUMCquandhityOrdnad) As itemslounE
SUMCpriceEah xquantityuOrdened) As Total
FROM
Ordmddalk
GRoUP BY Otdn Numben
HAVING
etal 1O0o;
Page No.
Date:
2) GRoDP BY:
GRODP BY Clause Qroups a Act o rOUs into a set
Lummauy reu0s by vaules o COumn o
Pxpressian Ihi GROUP BY Clause hehuuns oNA YSUD or eadh
qroup
eten ued with aggneate unn R SDM AVG,
MAX MN Qnd CODNT ACLAU
Sunta
SELECI
C1C2 m, agareqate fn CC1)
FROM
tablu
WHERE
COndai
GRoDP By C1C2,G n
Erample Table
OIdia
OYden Nwmber
ShippedDate
Stadu
Cubtomon NumD
SELECT Output is sormethina R
status Concelld
FROM
Disputed
Ordens In proces
GROUP BY status Held
HaL stotus Itema |S
areuped
Page No.
Date:
Tabl1
Studant NoNomManRs StudunthoNama Hanks
Tahn as Mauy 50
May 80 Doman
IDamen 5 Mat
ONION
Unien_ Combinzs hoo dilaunt rEALts
Intn a sinqlu bealut in theocm o_aobtained by aQueny
tablz
Erampl
SELECT Nam FROM Tahu1T l displau the
hames o_all sudants m
UNION t h Tabl
SELECT Nam FROM Tabl2 eohn 1 and Tabl 2
Damen Hanu.etz
INTERSECION
I intenbechan openatar QIeS dhe hi Common
yalus behoeen th uo LS that anu data
Pxompl iintersected_
SELECT Namu PROM Tabl 1
INTERSECT
SELECT Name HROH Tab2
L l displaythe names
ostudunds that an
present in Tabl 4 and Tabl 2 both
Page No.
Date
SET DIEEERENCE
Ihz Att difmince apenathon akis thi hoo ct and
etunns h: vallue_dhat 0ne in_thu rst Att
but not tha sLcond se
xampl
SELECTName aam labl1
MINUS
SELECT Nam FROM Tabu 1
Schadul
Seia Norn- Senial| Sd Serialigable
Schudule Schadul Schadul
rad A) tead(A
LoHle () read)
headM LOtkA
read(A) A:AtM:
AAM LOMte(M2:
Wite (M):| louleCA)
On Schadulu A, all opexahians T QL excued belar
TCSenialSchadul)
Atoomictu-
Ironsachol takes place at once o doesnt happen
at all- lhuy do not occLUn_ pochally
Lrwelmeh
0)Abot-4 hansacion aborfs chongemade u
net yisbl&
b Como-T yanha
dhonConwnts hanacs TL
isibl
BEFORE X:S y :2
TansaChion T
Read X Read
CY)
X:X-1 Y: Y+l
Wrile CX ortte CY2
AETER Xy AER Y:3|
Page No.
Date:
Consistenay
Inte arihy mst be maintained so-that datababe Is
ConAistent belar and allen tu fasachon Tt
lens to otecnesS database
lencedatababe is conbiStent
Iselatien
INs propenty enUneS Dulipl branbadion an CccLn
IndapendanHy 1rthatt intnenunce dhangaes ocauin4
a pantiauan ransachon wl net be Visibla wthaut
fo anu then_banba.chon unhLthaf ntialan_hange
In that anbachon ic OHtTen o mermon Oc has
been ommitecd
onaiden,
TL
Riad G Read2 X=2
2 Road CY) Read Lx); Y-3
3 X:XEY X: X12 Z=y
4Wite) WteCX
Page No.
Date
Dunabuits
his propenty enAUNeS_tha dnce thfyanadin
has Conmpluted eeuienthi updales andd
madincahons to th databhe an stord and
LOrNten to disR _and thuy pasist even t a ustern
ailu OCLL Ih2oe updates nouD becama peapranen
and an_stotd In nen-velailu memaru