Dbms Tutorial
Dbms Tutorial
G
NATIO NAL rNSTIT UTE OF T ECHN OLOG Y , HAMIRPUR (H.P.)
DBMS
ASSIGNMENT I
QI. A database is being constructed to keep track of the teams and games
of a sports league.
A team has a number of players , not all of whom participate in each game.
lt is desired to
keep track of the players participating in each game for each team, the positio
ns they played
in that game, and the result of the game. Try to design an ER schema
diagram for this
application, stating any assumptions you make. Choose your favorite sport
(soccer , football,
baseball, .. .).
Q2. Consider the ER diagram shown in Figure below for part of a BANK
database. Each
bank can have multiple branches, and each branch can have multiple accoun
ts and loans.
1. List the (nonwcak) entity types in the ER diagram.
2. Is there a weak entity type? If so, give its name, its partial key, and
its identifying
relationship.
s. List concisely the user requirements that led to this ER schema design.
6 _ Suppose that every customer must have at least one account but ishrestricte d to at
most two loans at a time, and that a bank branch cannot have more t an 1000 1
oans.
How does this show up on the (min,max) constraints?
BANK
I ~ N BANK-BRANCH
( I ,n ) ~ (I , I )
L - -- - -
(
\ BAl~K. -llRAl~CH
LOAl'l LOAl~S
(0 ,\000 )
/ ----
QS . Consider the re
lation database of T
each request: Give able \ . Give an ex
a\\ managers in this pression in the rela
database a lO perc tional algebra for
Q6. Consider the ent salary raise.
insurance database
Construct the fo\\ow of Table 2, where
ing SQL queries fo the primary keys
r this relational da are underlined.
tabase.
l. Find the numbe
r of people who ow
ned cars that were
2. Add a new acci involved in accide
dent to database, as nt in 2007.
3. Delete the SAN sume any values fo
TRO belonging to r requires attribute
"Prateek". .
Table 2:
Person( driv cr-i d,n am c,ad drc ss) Car (license, model, yea r)
Ac cid ent (re por t-nu mb er,data location) Ow ns( driv er-i d,li cen se)
. . '
P arttc1pated (d · ·d age -am oun t)
nver-1 , car, report-number, dam
SQ L que ries for this rela tion al
bConsid er the dat aba se of Table 3. Con stru ct the following
Q?.
d ata ase:
o wo rk first Ban k
nam es and citi es of res idence of all em plo yee s wh
I. Find the
Corporation.
all em plo yee s wh o wo rk for
Fin d the nam e, stre et num ber , and cities of res ide nce of
2.
more than Rs I 0,000.
the "NI T, Ham irpu r" and earn
3.
Table 3:
city)
Em plo yee (person-name, street,
y-n am e, sala ry)
Wo rks (person-name, com pan
)
Co mp any (co mp any -na me , city
er- nam e)
Ma nag es (person-name, ma nag