Beruflich Dokumente
Kultur Dokumente
This assignment has four questions, which carries 80 marks. Answer all
questions. Rest 20 marks are for viva voce. You may use illustrations and
diagrams to enhance the explanations. Please go through the guidelines
regarding assignments given in the programme guide for the format of
presentation. Answer to each part of the question should be confined to
about 300 words.
Question 1:
1
EMPLOYEE (ssn, e.sex, e_salary, e_name, e_add)
These keys are called primary key, super keys, candidate keys,
alternate keys.
2
• The duration of the programme is in semester. A course is taught
in atypical semester of the programme.
List all the entity sets, attributes of each entity sets and relationship
sets. Draw the E-R diagram for the requirements as listed above for the
database system. You may use the concept of keys, cardinality etc. in
a proper way. Make and state suitable assumptions, if any.
y
r
x d
l a
e d
n l
s a
Uni.id
s a
_ _
Uni,na Uni.a s
E
s
E
me dd _
E
Work
UNIVERSITY EMPLOYEE
Ans. For
cont Addre
Cond rol
Regis ss
uct
ter Exam_su Phone
m no.
Exam Date of Exa_Center
exam
H
App a
ear s
Class Room
STUDENT
s. .
y. n
. s o
e t o
o e n
m ci ti
n r x a a
a m
l e
3
N d p c
ol d S o
_ a o
_r a o
S C L
S R
S
4
(iii) Create the relations from the E-R diagram that you have drawn for part
(ii). The relations must be at least in 2NF. You must do the following
with the relations
Even though 2NF not permit the partial dependency but does not
remove transitive dependency.
FD
Block NameYear
Above relation is in 2NF because all non prime attributes are fully
functionally dependent on the relation key (say enroll no) but there is
still transitive dependency is
(iv) Perform the following tasks using relational algebraic operations for the
relations created at part (iii):
(b)Find the student name, programme code and the programme duration
of the programme in which s/he is registered.
5
Ans. PROGRAM (course_id, course_code, course_name, course_title)
(PK) = Course_id
(PK) = Student_id
The following are some different ways of stating this query in SQL.
REGISTRATION course# in
SELECT C2 course #
FROM course C2 wfere C2 course # > 300 and cl. Course # = C2.
Course #
Question 2:
(i) What are the problems associated with data Redundancy in a relation?
How can you solve those problems? Can referential integrity
constraints help in addressing those problem? Give reasons in support
of your answer.
Given two relations R & S, suppose R refers to the relation S via a set
of attribute that form the primary key of S and this set of attributes
6
forms a forign key in R. Then the value of the forign key in a table in R
must either be equal to the primary keys of table of S or be entirely
NULL.
a) INSERTION
b) DELETION
c) UPDATION
Ans.
Do not be sufficiently normalized in the sense that they will suffer from
problem of repetition information consider
7
BC_schema=(E.id, E_name. E_address, E_age)
c) To access records easily & fastly pointer are used to chain records.
8
End of record
KEY HASH
ADDRESS
VALUE FUNCTION
Let us consider a hash function h that maps the key value k of the
value h(k) that is address ares of records lies between some range
suppose s1 and s2
h (k) = k mod s
9
block size of 1 MB. Assume that the primary index of the relation is
ID and its relation is required mostly for the application that
generates programme wise list of student names in alphabetical
order. Create a secondary index that will improve the performance
of the system for the given application. Show how many block
transfers will saved on average due to creation of index. Make
suitable assumptions if any.
Aron
Abolt
Ascolta
Aoron .
Acolon .
Allen .
: .
Wrigth .
10
Adam
R.robin
Akess
Allen
Andew
Aluson
Wrigth
Wyth
Zewin
Secondary index is also in ordered file with two fields. The first field is the
same data type as some non ordering field of the data five that is in index
field. The second field is either block recorder pointer.-
Secondary Key
Index field value Block Pointer
9
1 .
2 . 5
3 . 13
4 . 8
5 6 .
6 15 .
7 3 .
8 .
17
9 . 21
14
10 . 16
11 . 2
17 .
12
18 ..
13
19 .. 24
10
14
20 ..
20
15
21 12
4 .. 1
16
22 23
7 ..
11
23 18
19 .
24 14
22 .
Question 3:
Account(ac_number,ac_holdername,ac_holderaddress,ac_balance)
Withdrawal(ac_number,wi_type,wi_date,wi_amount)
From account)
(select ac_number)
From deposit
(select ac_number
From withdrawal)
described as follows.
12
(ii) Perform the following queries using SQL for the relations of part(i):
a. Find the list of the account holders whose account balance is less
than Rs.1000/-
b. Find the details of those account holders who have withdrawal nore
than Rs.1,00,000/- in the last month.
c. Find the sum of deposits that has been credited in each account in
the last year.
d. Find an account holder who has not withdrawn any money in the
last year.
Eq.
Update account
From account
(iii) Write the psedocode for the withdrawal and deposit transactions for
the schema of the bank given in this question. Use two phase locking
13
protocol and lock the data items suitably such that there is no
concurrency related problem in the database.
Ans.
Account Acco
unt Deposite
Holder
Bank
Officer
With drawal
Acc.
Addres
Name
s
14
F/G-
(iv) What is a deadlock? How can you detect deadlock? Explain with the
help of a wait for graph. What are the possibilities that the deposit
and withdrawal transactions as created in part (iii) will result into
deadlock? Explain your answer.
Let us consider there are ‘n’ number of concurrent transaction (Ta, Tb--------
Tn) and m number of resource (ra, rb, ----- rm) that can be shared.
DEADLOCK DETECTION
Question 4:
15
(i) Consider the database schema of Question 3. Create sample
transaction log for the transactions that you have defined in Q3 part
(iii). Explain how this log may be used to recover from failure.
a. Physical Level
b. Logical Level
VIEW
VIEW VIEW LEVEL
VIEW 3
1 2
LOGICAL
LEVEL
PHYSICAL
LEVEL
16
Level of data abstract
(iii) Now, assume that the bank schema as given in Question 3 is being
implemented using distributed database. Suggest suitable data
fragmentation needed for this distributed database.
Ans. Consider the relation schema deposit (id, branch, account, customer
name, balance)
17
ID BRANCH ACCOUNT CUSTOMER NAME BALANCE
1 Bombay 305 Brijesh 15000
2 Bombay 475 Ajay 12000
(iv) Compare and contrast the two tier model to that of 3 tier model client
server architecture. Can you implement the database given in
question 3 as a 3 tier model? Explain your answer.
CLIENT SERVER
Executive
Sent reqest
Response
Want
Sent reply
Receive reply
18
A client/server computing can have more than on server and clients.
NETWORK
File File
Server Server
19