Question
Consider the following relations: Doctor ( SSN, FirstName, LastName, Specialty, YearsOfExperience, PhoneNum) Patient (SSN, FirstName, LastName, Address, DOB, PrimaryDoctor_SSN) Medicine (TradeName, UnitPrice, GenericFlag) Prescription (Prescription
Consider the following relations:
Doctor (SSN, FirstName, LastName, Specialty, YearsOfExperience, PhoneNum)
Patient (SSN, FirstName, LastName, Address, DOB, PrimaryDoctor_SSN)
Medicine (TradeName, UnitPrice, GenericFlag)
Prescription (Prescription Id, Date, Doctor_SSN, Patient_SSN)
Prescription_Medicine (Prescription Id, TradeName, NumOfUnits)
Note: The Medicine relation has attributes, trade name, unit price, and whether or not the medicine is generic (True or False).
- Determine the functional dependencies that exist in each table given above.
Example answer for - Doctor table:
Doctor (SSN, FirstName, LastName, Specialty, YearsOfExperience, PhoneNum)
Write Functional dependency exists in this table:
Doctor_SSN FirstName, LastName, Specialty, YearsOfExperience, PhoneNum,
Patient_SSN
- After determining the functional dependencies, convert these tables to an equivalent collection of tables that are in third normal form (3NF). If they are already in 3NF justify your answer.
Example: Answer for table Doctor
Doctor (SSN, FirstName, LastName, Specialty, YearsOfExperience, PhoneNum, *Patient_SSN)
1NF: No repeating groups. So it is 1NF.
2NF : check Partial dependency on the primary key, so the relation is in 2NF.
3NF: Check non primary key dependent on another non-primary key attribute
No So it is in 3NF
Repeat this for other tables.
- Write SQL queries to answer following questions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started