Running head: DATABASE DESIGN LANGUAGE 1
DBDL Final Project
Jessica Ndegwa
University of San Diego
DATABASE DESIGN LANGUAGE 2
Pharmacy Database
A pharmacy has a database of different types of medicines. The database should store the
details of all prescriptions brought by patients. A prescription belongs to one patient. A patient
can have multiple prescriptions. Tables:
• Patient
Patient (MRN, Street, City, State, Zipcode, PhoneNum)
- MRN is the primary key for the Patient table and cannot be null.
• Prescription
Prescription (RxNum, MedicationName, Directions, Qtyfilled, Refill, PSBR,
MRN)
- RxNum is the primary key for the Patient table and cannot be null.
- Both Patient and Prescription tables have the MRN field in common. The MRN field in the
Prescription table is a foreign key that must match the primary key of the Patient table.
Patient and Prescription have a one-to-many relationship:
Patient (MRN, Street, City, State, Zipcode, PhoneNum)
Prescription (RxNum, MedName, Directions, Qtyfilled, Refill, PSBR, MRN)
• Patient
Patient (MRN, Street, City, State, Zipcode, PhoneNum)
SK PhoneNum
- No alternate key identified
- No foreign key identified
• Prescription
Prescription (RxNum, MedName, Directions, Qtyfilled, Refill, PSBR, MRN)
DATABASE DESIGN LANGUAGE 3
AK MedName
SK MedName
FK MRN Patient