Вы находитесь на странице: 1из 4

NCU-FORM-29

Question Paper-Minor Test Review Date:


06/08/2019
School of Engineering & Technology Semester: Odd III
Programme: B-Tech Session: July-Dec
Course Name: Database Management Systems
Course Code : CSL 214 Maximum Marks: 50
Duration :90 mins
Sheet 1 of 4
Note: 1. All questions are compulsory.
2. Marks are indicated against the questions.

PART A (15 Marks)


CO1 Q1. Differentiate between super key, candidate key and primary key with suitable example. (5 marks)
Solution:
 Super Key: An attribute or set of attributes that uniquely identifies a tuple within a relation.
Multiple super keys are possible.
 Candidate Key: A super key such that no proper subset is a super key within the relation.
Multiple candidate keys are possible.
 Primary Key: Any candidate key whose values are always NOT NULL. Atmost one primary
key is possible for any relation.
 Example
CO3 Q2. Find all the candidate keys for the following relational schema (5 marks)
A ( P, Q, R, S, T)
F = { PQ  ST, R  T, S  R, T  P}
Answer: PQ, TQ, RQ, SQ
CO3 Q3. Consider the following relational schema and their respective FD sets. State whether (5 marks)
following decomposition of R satisfy lossless join decomposition or not with justification.

a) R= {A, B, C, D, E}
F = {E A, CD E, A BC, BD}
D = {(ABC), (ADE)}
Answer: Lossless

b) R (A, B, C, D, E)
F = {AB  C, C  D, B  E}
D = { (ABC), (CD), (DE)}
Answer: Lossy

PART B (25 Marks)


CO1 Q4. Explain Referential Integrity Constraints with respect to Insertion, Deletion and Updation. (5 marks)

Issued by: Approved by:


Date: Date:
Solution:

CO2 Q5. Consider an Entity-Relationship (ER) model in which entity sets E1 and E2 are connected by (5 marks)
an m : n relationship R12. E1 and E3 are connected by a 1 : n (1 on the side of E1 and n on the
side of E3) relationship R13. E1 has two single-valued attributes a11 and a12 of which a11 is the
key attribute. E2 has two single-valued attributes a21 and a22 of which a21is the key attribute. E3
has two single-valued attributes a31 and a32 of which a31 is the key attribute. The relationships
do not have any attributes. Map the above ER diagram to appropriate Relational Schema
with all primary and foreign keys.

Answer:
E1(a11, a12)
E2(a21, a22)
E3(a31, a32, a11)
R12(a11, a21)

CO3 Q6. Compute the canonical cover of the following set of functional dependencies of R(ABCDE) (5 marks)
F = { A  D, BC  AD, C  B, E  AD }

Answer: { A D , C  AB , E  A }

Issued by: Approved by:


Date: Date:
CO2 Q7. Which type of entity cannot exist in the database unless another type of entity also exists in (5 marks)
the database? Explain with example.

Answer:
Weak Entity – An entity that does not have a key attribute of its own. The existence of a weak
entity set depends on the existence of a identifying entity set
 it must relate to the identifying entity set via a total, one-to-many relationship set from
the identifying to the weak entity set
 Identifying relationship depicted using a double diamond

CO3 Q8. Given R (A,B,C,D,E,F,G,H,I,J) and set of functional dependencies F = { AB C, (5 marks)
B F, A DE, DIJ, FGH}. Decompose the relation into their highest normal form.
Check whether the decomposition is satisfying dependency preservation and lossless join
condition or not.

Solution:
Candidate Key : AB
Given relation is in 1NF because of the partial dependencies – B  F, A  DE
For 2NF: R1 (ABC), R2 (ADEIJ) & R3 (BFGH)
For 3NF and BCNF: R1 (ABC), R21 (ADE), R22 (DIJ), R31 (BF), R32 (FGH)
Dependency preservation and lossless join condition are satisfied.

PARTC (10 Marks)


CO2 Q9. The Prescriptions-R-X chain of pharmacies has offered to give you a free lifetime supply of (10 marks)
medicine if you design its database. Here’s the information that you gather:

 Patients are identified by an SSN, and their names, addresses, and ages must be recorded.
 Doctors are identified by an SSN. For each doctor, the name, specialty, and years of
experience must be recorded.
 Each pharmaceutical company is identified by name and has a phone number.
 For each drug, the trade name and formula must be recorded. Each drug is sold by a given
pharmaceutical company, and the trade name identifies a drug uniquely from among the
products of that company. If a pharmaceutical company is deleted, you need not keep track of
its products any longer.
 Each pharmacy has a name, address, and phone number.
 Every patient has a primary physician. Every doctor has at least one patient.
 Each pharmacy sells several drugs and has a price for each drug. A drug could be sold at
several pharmacies, and the price could vary from one pharmacy to another.

Issued by: Approved by:


Date: Date:
 Doctors prescribe drugs for patients. A doctor could prescribe one or more drugs for several
patients, and a patient could obtain prescriptions from several doctors. Each prescription has
a date and a quantity associated with it. You can assume that, if a doctor prescribes the same
drug for the same patient more than once, only the last such prescription needs to be stored.
 Pharmaceutical companies have long-term contracts with pharmacies. A pharmaceutical
company can contract with several pharmacies, and a pharmacy can contract with several
pharmaceutical companies. For each contract, you have to store a start date, an end date, and
the text of the contract.
 Pharmacies appoint a supervisor for each contract. There must always be a supervisor for
each contract, but the contract supervisor can change over the lifetime of the contract.

Draw appropriate ER/EER diagram for the above database requirements.

Solution:

Issued by: Approved by:


Date: Date:

Вам также может понравиться