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 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).
Example answer for - Doctor table:
Doctor(SSN, FirstName, LastName, Specialty,YearsOfExperience, PhoneNum)
Write Functional dependency exists in this table:
SSN à FirstName, LastName, Specialty,YearsOfExperience, PhoneNum, Patient_SSN
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.
Answer-
SELECT*
FROM medicine
WHERE unit price <$50;
Answer-
SELECT FirstName, LastName
FROM Patient
Where FirstName = ‘John’ AND LastName = ‘Smith’ ;
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).
Example answer for - Doctor table:
Doctor(SSN, FirstName, LastName, Specialty,YearsOfExperience, PhoneNum)
Write Functional dependency exists in this table:
SSN à FirstName, LastName, Specialty,YearsOfExperience, PhoneNum, Patient_SSN
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.