0% found this document useful (0 votes)
14 views

Dbms Assignment 2

Uploaded by

missioncancer
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)
14 views

Dbms Assignment 2

Uploaded by

missioncancer
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/ 20

temo: ulaton wehema,

Uelalon datals wohm domainyvelation


wehema
Wnalanee , dalation cadenalty and Ualston

hai-latin dohemai- lotion wchuma


cth stutire
ity ame and the uit f alttuiutio alomg
tth thi c8utending denais.
" olslie database sohema:- colkctier e
vlation chuma tht dfrn the stuttu
a sustinal datalase

attilati in a valati uohema.

dato valsw fe cach atbibitu ano tuhle.

un a tlatin) dntane.

sation gui-h mo. áthiluty (asumn)


cn a tulotion chuma.
us hot vas the charaalvstiob s% a
in a tolatlonol databae model
deelit
Filatbr in a Melatirnet
datalas:
" Chdvd duhle:- Bach au iny an wrdvad
cigwnce valuy.

uidntteal.
Chomeginy Athaiduty :-Al dtbiilts uth
a tualatim mut haue the dame

selaton
Can
chang
Nort Bmleddd Ualues:- Valu usithin a
mst de atemi

selatinel ditalbase
dufhliat.
Ldata and wndÚte cthat

cthu
On cdhu
huy iay a oucial vshy uin
*Lemaliyatin:-
date nae
diminat dota edundany
dstabase duig.

datatase vonsialncy.
BLUsLs,that cdato
i-.doatil Bnthgt,i- &nsusus
aluly ae valic. t fsasst
oefuns diivan
ineonltincã) cand data lou y nsing
tis
dhat youign ay fust
teugntys= thiutiy dhat
kw in oelstid tally. thy tabliss oaloton

cthe celatiornal data cmsdol ndl

" Jhe oulatitnal data mdel a ttruetuedd


cdate
ushg tolls , cslmn' a anok tows.
Bt oastd n cthe coneht f oaelatio uhi
case ast of tahla (oesu) hat shae tte
csarme ctthtlat (eslumn.
tles (ou) dhat shoa
o ducts
Aelatio- celum)
dhe sam atbidutiy (
e chaactirsti

atbetu

dingle contancl f thwdata.


cin ca ulaton
Wchemat- 9doal deuethtion f ca elati,
is cndmL, atbilitw and thei
dataf
usbi-Jaue do cthey
cGndains

conitiaila foau
h delotiin
citgit, conilraito foeus n the cnen-t ,
echanlm-ja onstialits cae

dhe databasl ytin


Sofasti-Veolattyg hy eonabainti can daad ta
data tedumdanyanoh ncondisttncs shile
knásting
un
anbry, data flexljelt, for
oifbmation.
shaneasatlalle
olata enhltns accuagy
and cutain cthe
is
valuy thata indicat louso aabals NL
Constrantu?
ofhoncid fravenbig dydatabas
lata
talle.
statini)
y i-banento bata
casentisl: consstncy aethy y
mans cdataba salatenall dthet
alidallesIhiy altd. diatiue calevesence data clhat
they cate ae usky cand saints
tt uatiyaty sefrentiol
bau. functiordng frafu dheent
e
scenatoy uoto ctoln atbrl
cooycdy hancle
() o
áluy fusude a
shtionol,NL
mstt nat le
dhal
Constadai
ehougn y coniiait
Oburiay y oritoint y'CHEK Coalant
Belatiiral ccaladd
coalels
flan cdhe cconoht oraitonal algba.
luo. tt tllora fom
can heu -fruclat
mean t fecus
his hous to eetrieue
quyscteue
danguag athev cham he clesisac
o Cto deseeche
t. t olless 4
caecilng he aqun
ouutt wthsut
h datbal calculuy.
Rlstinal ckaulus CTRc)
dple (pR)
alational Calcalus
) olamain
elatal ccalculu
boradral uohat tautt
hou to
sltain dhe oeesdt
Bocs enst ufhecthi
the erdo
sforatibu.
Aonai-ndhendent con
dfendent
OHeRE sil= (seLELT did PROM suhhliv wHERE
Ules 40;- dlhat i ca foeign y ccontba int?ohat
ae scclo conibat tifutot

tale dotte . nswas dhat tholns


cn a csluny cn trtle matothes
dhe aaluss in a ccolumn Un anglh
talle.
Gryfatamce f_eagn heycontraint
Conibnaiste:
acoutaey aho oiaalngy a data
Umaintain dhe
vals
cthat the
alny hainty to iom
haist talle.
corääito fant ojban
fougn y
oucstd

call uto tfvanci a valid. Gn dhe


stating that mean that
Coritat selale dátabasw, t
y forigm ky valu must a
SELECT mame
Gomy' hati
(SELECThitFROM cataleg);
UHEREfua IN
sho sufyhy
uny hart.
SELET dname
PROM dhhlics
LOMERE MoI EXSTS
SELECT
Jeem tastu
HERE f NOT IN (delest hid FRoM cótaleg

e) tnd dhe dnames suplas usho chy auey


Aeol hat.
SELECT Udnome
FRet duhlass
WHERE NOT EXISTS (
SELELT
FRoM l a t
LSM ERE Color=teol' AND hal NoT LN (SELLCT

J;
atalg
canet alse.
seLCT nome
ARoM hat
lOHERE huil TN
SELQLT huol
PROM catalgg
LOHeRE Adl= (seLELT die PRoH csuhhliva IHERE
Sname='Aome slsdgt duutliru')
AND hausl NOT ING
sELCCT hil
PRoM catalegw
Aname)

who cohangu cthe mot yor dhat ant.


SELLCT BnamU So name

Jsin calalg Con hfail= Cfaiol


S.tol
JolN SoN e. lol
WHERE cat=
SELECT MAx (eest)
pRoM cataleg

SELELT d l
FROH chuphlts
OHERE NOT EXIS 7S C I.

PROM UCatalg
sed fhano cand grwr haito
SELLCT l i
FROM dufhhlina
OHERE ENSTS c
SELECT
PRoM Cataleg
JoIN art oN Coud =pfue

AND EXSTS
SELECT
FRoM

J;
'grun'
jolling ulatioy
namesß aboaft csuch dhat flite
t the

SELLeT amome
fROM QCeapt a
WHeRE NeT EXI STS (
SELECT
FROM
JoINS
UMERE C. a = a aol AND erwalay C= booo
cvtefct hor sten uhe
SeLeeT e. ud,MAX (a.Oisimgog
fRoM Bnleyee
TOIN Cvbla coNe. atl= Cuid
JOIN Nouoa7t aaON ci eeal aia l
GROUP
sauing sunt (*)>34
to
fend te named
JAonsldy:
SELELT
e. erane

FROM Emloys
coHERE e.satay <(
SELALT MIN /1 huiey)
PROM Jghta t
Jleneus
J;
all atueroßt - jor thu' atoaht.
seLeeT a: name , AVG (e.vlalo)
PRoM Aneolt
JoN
JOUN
WHERE
GROUP eruisrange uooo
By a,
mam;
tenc the mames
dome
SELLCT eunm
fROM Snphyue e
Jo IN a- aid
OHeRE a. aname LIKE.. Gsung 7'j
cme than

FROM
ONERE N&T SX LSTS (
sEECT
FROM Enfleyes e eid
JoN vtipleol CON e lol =
JOIN
a e.o o o00AND
9HERe a. eruisgge
<f

funt cthe
the name

polot.
calay
FROM Enpleyee e e

SHERE alany C
SELECT AUe (e2-salay)
PRSM Bnplayus e a ceLol = c. ecol
TOLN CUiol (oN e2
ANDe lNOT IN (eeLceT ol frorn crhuo)s
uw 3e- Considr dhe
Laantmnent as aut
SALLT erhame
FROM Bme
ToN DEPT d ON e.J me = d- Dvnm
cOHERE dDunum =(dELELT D no rROM m
lOHeRE Name Rav)
r) letine the no.
empleyeccnt4)
SÊLE
"Rang".
FROM DEPENDENT
LOHERE £SSN = (SELECT SSNAROM EMP oHERE
NaME =Pau")
--fenale
olshinelerto
SELECT emam

Mg,HSSN
JoN DEPT d oN esw N=d·
oN d Dmum = dl.p mun
JOUN DEDT L oc dl
eecation = DELHI'
OHERE dl.
AND N0T £X1STS (
S£LECT
fRoM DEPENDENT
SEX =»e?
OHERE £SS = e. SSN ane

sELLLT Vame
fROM em >S0006
IHeRL Drng = QO ANo Wala
AND Sx - p7
ctt csE"lefratmunt olatail
SELECT
fRUM DEPT
wHERE D mom csE;
(lusye- Cond cthe follaslng coRPANY Lelatabase.
) Retie cthe name Ruearch
Keartmnt.
OHERE DEPT eht-oe)
Aname=
pnol the mama partorent
rlome (Emh Do wORKS- ON bo ÅROJELT) 4OHERE
PRO JECT
Dnum y
A49) abve ctha ssn_ eohartnent numler
Gn Do mo =y)u r
(TT SS NCE MP LOHGREBnfh. Domo =4) n
Cdutor ssN(mh HERE
TT SsNcs Emh)
du) etiie the names
eolyhartmenls.
ome (tmh o OEPENDENT)
7T lame (Bh) T

IT Dnum, Ceunt (olame), Avolsalany)


(Emh DEPT) GROUP By Dwm.
ecesri lConsides ethu
(Rlall no.

SELELT Roll o, Wame


RoM strdent
OHERE BanhSE';

fuiol cthe
the name -hubetshe.
'SLRI tudint.lome
PRoM dtrielt
ISSUE.Rsll ,
INNER TOIN ok ON ISOE, TE BNBo0%.T«BW
OHERE B00K. lslhu ABO:
( it ttte all lostki utuodent RAM.
8£LECT BooK Tttl, Book. the
FROM utudnt
INNER ToIN IssU£ ON Atdent. Rollasne Rl n.
TNNER JoN tudent ON Is3UE. gll mo = sidt.

WHERE studot .NameRAM';


t)it dhe title dehou ambo,o20.
SELECT GooK. tle
ROM Bosk
INNER, JoIN TSSUE bN BoK. I SBN= une. 1sBN
NERE IssUE. at- - swe =2o20 -12-o17);

SELELT BoOK. be
PROM Book
LOHERE Rbssk. lllslshuo A8e;
Falatinal Agleas
9T Roll mo, vlame (o bonch=sEl utudent)
vlame Ra Roon)

stadent. Kam RA Boor)

Busbi-ENRedL (S#,c#» Lhction) ---- duje calouan


0 dit oh, utadent tattng cWas uithwmith or fones
SELECT DÊSTINCT S#
FROM ENROLL
nimles
é la0 dat all estucent talung ot least onc
COUNCe cthat
PLeT OSTINTS #
ROM ENROLL
TNNER JoIN A DIcE ON ENROLLS# = Aovce.st
INNER JoIN TEACA ON ENROLL.C #- TACH. Ct ANDENRALL
SETION= TECH. Aucten
HERE ADVICE.fa=
tte Wame ccewce,
SELECT
ROM TEACH
GROUP
HAUING,CooNT S1;
á t all ctte utiident no. and c mumllt.
SELEUT S#,
FRoM bRADE
wMEINE
gade -9;
sto get gsdeA.
SELECT S#, CH
FReM GRADE
oMERE gad

Etnith'v be4=fonw')
Os3#, kdian ,be, (Ensl (S#h , c#, detin ^

Zad(h,c#, dcon
) S#, Ct INkoLL(S## ,c#, aotien)y
( tt, +l GRADE (S#, C#,(0, yea)}
Ulus 7i- liit the
- thathane 3
cdhe
oudtt).
SELECT til
FRoM cSUA =tconuti
comulö ucwna 'ANDcoudity
lHERE diht = namm
) find the l0sa all utudent--.. n dhe dudto
) tind
SELECT DISTINT tudent.TD
FRON studint
VON tatRy ON student. o= tales. TD
JOIN eachw oN daku CgUe-10 = taehs curse D
AND talRyseo uol= tachus sc
AND alkw
dakua thaous. csemst
AND aks yar diactus. yar
wHERE wnsteuctr. mame='&unstin;
cnatuoto.

'sELETwntucte
HAX (etaiay)
nd all wntuto
salay
SLLLT TD,
TD, (nane
FROM wntuotor
wHORE Ldalasy -(sLLeT HAX(csalay) FRoh (urutucte;
) fid dhu ensllment da seatiow dhat os
SELQT lcowcél, dc -d
coUNT(*) A ensllnest
AR0M taks
=20/7
WHERE semesl="Jall" AND Year
aamum ensallmnt, ava al
the

SlrT MAX (anmellment)


Fro(
SALT CoUNT (*) 4en sollmunt

oMERE sumat hll 'AND Yeon Ret


CRoup
with atalay
--- dfartmnt ly
VPOATE unitui
cnuotr A.

SET
wnERE(Llay -dalay
dt-non= Contu- sdelnc' ;

DELETE RoM CrA


CoMERE cowrse-a NOT JNW(SElECT cowrue-d from

studt dalany /o0o0


TNSERT INTO uatuclir
vname,d t a uydalary
(I5; lo0D6
SELEC S# Sname, det-vnant,
FROM student
coNERE /ot- eeoltseo
aomlayo r---(0, «amaunit n)

7Tename (ocity 'umám' amflay)

salory c guatin thon looo,


Wename ( salany >looo oo wnfayce)
feid dhe name cad
Tename loet =(mlami'A csalay>100OO0
>to
d) feriot dhe mame dacemplaye)
ranel loacte
cehteage
the IO drand)

Cuyo eoniide dhe Keontse loan)


follosig sdhima?
selotinal eolaw anol coomain
ccaloulus. Gelational
no the mamu
Aeme uol rata.
Ai-T nome (uuhhlavs Ayrcolor'seel' frart)

adduiw) nfatoyui hname, r)n


sudly cdmamnt, caddres) afat lpud, trame,

cthe csde

yo colo IN(uol', gen)


tas)

color Cudupplare (ubl, snam, taddru)


forto (hudl, pnomuycoely) Acalalg (aists
udly cot) ^(eeloh=rucl' OR eslor =ghud
DRC:- fuid l 3 mamu, addres, puil, hmame,

fart lhudhmome esle) Aeataleg (uiat,


hud, cst) ^ (cèelon=us' oR
eslogun')
cosler=uod' parto)
TRU3- (edeol l cnamsaddus, huil, hname, coL
pname,uc)n catolg lsiby fuil , <c8st))OR
221' loeter Ae

You might also like