Assignment - Final Project
Assignment - Final Project
Submitted to:
Prepared by:
Jessica Ndegwa
Executive Summary
A pharmacy database was created to store data of patient prescriptions. This data includes
information found in a prescription such as patient medical record number (MRN), address,
medicine ordered and ordering prescriber (PSBR). To avoid the risk of update anomalies or
patient, but a patient can have multiple prescriptions. The database was created in Microsoft
Access with two tables created namely Patient table and Prescription table with MRN as the
foreign key. Two forms were created for a user of the pharmacy database to enter data in either
table. Two queries were made to retrieve specific data from the database, and two reports were
1.0 Introduction
A pharmacy has a database of different types of medicine. The database should store the details
of the prescriptions of all the patients that use that pharmacy. A one-to-many relationship exists
whereby a prescription belongs to one patient, but a patient can have multiple prescriptions.
2.0 Methodology
• Tables
Data was retrieved from patient prescriptions. To represent this one-to-many relationship
between patients and their prescriptions in a database, while avoiding the risk of update
anomalies or inconsistencies, I created the following two tables as depicted in the attached
Both Patient and Prescription tables have the MRN field in common. The MRN field in
the Prescription table is a foreign key that matches the primary key of the Patient table. No
alternate key is identified in either table. The patient table has PhoneNum as a secondary key.
The tables adhere to the entity integrity rule as they each have a primary key which cannot be
null. Each table also adheres to the referential integrity rule as the MRN in the patient table have
matches the MRN in the prescription table. This one-to-many relationship is shown in the
attached Microsoft access file using a join line between the Patient table and the Prescription
• Forms
Two forms were created for a user to enter patient data in the Patient table and
• Queries
o A query was created to retrieve the MedName of Qtyfilled greater than 30. SQL:
FROM Prescription
WHERE (((Prescription.Qtyfilled)>"30"));
o A second query was created to retrieve the MedName of Refill greater than zero.
SQL:
FROM Prescription
WHERE (((Prescription.Refill)>"0"));
3.0 Results
• Reports
The relational database final report shows two tables namely Patient and Prescription
with a one-to-many relationship. Two reports were generated based off the two queries that show
the selected data in report form. The first report depicts the query used to retrieve the MedName
of Qtyfilled greater than 30. This shows each medication that was dispensed/filled with more
than 30 pills which in the database was Lisinopril and Amlodipine with 60 pills dispensed/filled
for each. The second report depicts the query used to retrieve the MedName of Refill greater
than zero. This shows each medication that had a refill quantity of more than zero, which in the
database was Simvastatin, Lisinopril, Levothyroxine, Amlodipine and Omeprazole with each
having 3 refills.
DATABASE DESIGN 5
This pharmacy database showed the benefits of storing data in a database whereby specific data
can be easily retrieved through the use of queries, and data can be added or removed in an
efficient and organized way without the risk of redundancy or inconsistencies. A database
administrator can ensure data security through user access privileges unlike an excel spreadsheet
whereby anyone can make changes to the data. Additional data which could be included in the
pharmacy database is patient’s email address, allergies, indications for medication use, side
Reference
Pratt, P., & Last, M. (2014). Concepts of database management (8th ed.). Boston, MA: Cengage
Learning.