Uploaded by Nguyễn Thanh Tùng

Lab2 assistance Slot8

advertisement
Group 1.
1.
Given the following relation R and the set of functional dependencies F that hold on R, find all
candidate keys for R.
R (A, B, C, D, E, F)
F = {AB → C, AC → B, AD → E, BC → A, E → F}
2.
You are given the following set of functional dependencies for a relation R(A,B,C,D,E,F),
F = {AB → C, DC → AE, E → F}.
What are the keys of this relation?
3.
Consider a relation Movies_Screened with attributes Theatre_name, Movie, Day, Time, and
Age_restriction. A sample table is given below
A theatre can screen more than one movie on the same day and time but on different screens.
Age_restriction provides the minimum age limit to watch that particular movie as instructed by
the central board of film certification. Does this relation satisfy 2NF conditions? Or, is
Movies_Screened in 2NF?
Group 2. (Advanced)
Below data is used to describe information of treatment for pets at a pet medical center. Using decomposition technique to
model these data into relational model basing normal forms.
Hint: You should start from 1NF to 3NF.
1. Healthy history report
PET ID
PET NAME
246
ROVER
298
341
519
SPOT
MORRIS
TWEEDY
PET TYPE PET AGE OWNER
DOG
DOG
CAT
BIRD
VISIT DATE
12
2
4
2
PROCEDURE
SAM COOK
TERRY KIM
SAM COOK
TERRY KIM
JAN 13/2002
01 - RABIES VACCINATION
MAR 27/2002
10 - EXAMINE and TREAT WOUND
APR 02/2002
05 - HEART WORM TEST
JAN 21/2002
08 - TETANUS VACCINATION
MAR 10/2002
05 - HEART WORM TEST
JAN 23/2001
01 - RABIES VACCINATION
JAN 13/2002
01 - RABIES VACCINATION
APR 30/2002
20 - ANNUAL CHECK UP
APR 30/2002
12 - EYE WASH
2. Invoice
HILLTOP ANIMAL HOSPITAL
DATE: JAN 13/2002
INVOICE # 987
MR. RICHARD COOK - 123 THIS STREET - MY CITY, ONTARIO
Z5Z 6G6
PET
PROCEDURE
AMOUNT
ROVER
RABIES VACCINATION
30.00
MORRIS
RABIES VACCINATION
24.00
TOTAL
54.00
TAX (8%)
4.32
AMOUNT OWING
58.32
Group 3.
1. The following relation schema is used to store information about the customers of a car service
center.
Customer (Customer_ID, CName, CAddr, Phone, Customer_Visit_Date, Service_Advisor_ID,
SAName, SAPhone, No_of_Cars_Serviced, Service_Date)
A customer is identified with a unique Customer_ID, he can have only one phone number, and he
may have visited the service center many times. There are more service advisors and each advisor
services many cars on a given service date. Any service advisors can be reached at only one phone
number.
Find the primary key for Customer.
2. Consider a relation R with attributes ABCDEFGH and functional dependencies S as follows:
S = {A → CD, ACF → G, AD → BEF, BCG → D, CF → AH, CH → G, D → B, H → DEG}
Find all keys for R.
3. Consider the relation R = {A, B, C, D, E, F, G, H, I, J} and the set of functional dependencies F
as follows;
F = { AB → C, BD → EF, AD → GH, A → I, H → J}.
Find the key of relation R.
Group 4.
1.
Let R = {ssn, ename, pnumber, pname, plocation, hours} and R is decomposed into three relations R1, R2, and R3 as
follows;
R1 = EMP = {ssn, ename}
R2 = PROJ = {pnumber, pname, plocation}
R3 = WORKS_ON = {ssn, pnumber, hours}
Assume that the following functional dependencies are holding on relation R.
F = {ssn → ename; pnumber → {pname, plocation}; {ssn, pnumber} → hours}.
Find whether the decomposition into R1, R2, and R3 is lossless join decomposition or not.
2. Consider a relation R(A, B, C, D) with the set of functional dependencies F = {AB → C, BC → D, CD → A}. Assume that R is
decomposed into R1(A, B, C) and R2(A, C, D). Find whether the given decomposition is lossless or not.
3. Suppose you are given a relation R(A,B,C,D). let us assume that set of functional dependencies F = { B → C, D → A} and R
is decomposed into R1(B,C), and R2(A,D).
(a) Find the candidate key(s) for R. (b) State whether or not the proposed decomposition of R into smaller relations is a
good decomposition and briefly explain why or why not.
Group 5.
1. Consider a relation Student (StudentID, ModuleID, ModuleName, StudentName, StudentAddress, TutorId, TutorName).
Each student is given a StudentID and each module given a ModuleID. A student can register more modules and a module
can be registered by more students. TutorID is the ID of the student's personal tutor, it is not related to the modules that
the student is taking. Each student has only one tutor, but a tutor can have many tutees. Different students can have the
same name. Different students can be living at the same address.
Find all the functional dependencies holding in this relation and normalize the table to 3NF.
2.
Let us assume a table User_Personal as given below:
Is User_Personal in 3NF?
3.
Consider a relation R(A, B, C, D, E) with FDs AB → C, AC → B, BC → A, D → E.
Determine all the keys of relation R. Is the relation R in BCNF?
Group 6.
1.
Consider a relation schema R with attributes ABCDEFGH with functional dependencies S:
S = {B → CD; BF → H; C → AG; CEH → F; CH → B}
Which of these functional dependencies violate BCNF (Boyce-Codd Normal Form)?
2.
Is User_The following relation schema can be used to register information on the repayments on micro loans.
Repayment (borrower_id, name, address, loanamount, requestdate, repayment_date, repayment_amount)
A borrower is identified with an unique borrower_id, and has only one address. Borrowers can have multiple simultaneous
loans, but they always have different request dates. The borrower can make multiple repayments on the same day, but not
more than one repayment per loan per day.
a) State a key (candidate key) for Repayment.
b) Make the normalization to BCNF. Show the steps.
3.
Normalize the following table. Show all work and clearly indicate the primary and foreign keys.
R(elevator_no, building_no, building_name, capacity, staff_no, first_name, last_name, date_examined) with the following
functional dependencies:
1. elevator_no → building_no,capacity
2. building_no → building_name
3. staff_no → first_name,last_name
4. elevator_no,staff_no → date_examined
Normalize table R up to BCNF.
Download