3. Executive Summary
Dr. Robert Slate is the owner and President of FirstCare Medical Centers, Inc, a small chain of medical centers in Alcoa, Florida. The
company was originally founded as a single center five years ago, but has since expanded to four centers in five years. The centers act as a middle
ground between traditional physician practices and hospital emergency rooms. Most of the patients treated at FirstCare make appointments in
advance but walk-in patients are also accepted if time slots are available. The centers are open from 9am to 7pm Monday through Friday and are
closed on weekends and holidays.
As the size of the business has increased, Dr. Slate decided it is time to automate the way his centers do business to maximize efficiency and
keep up with insurance company and government requirements. He has requested an automated system be created to track and maintain
personnel and patient information as well as a number of other functions. The systemwill need to be able to print the following: a weekly schedule
for each doctor, daily appointment schedules for each center, and patient profile cards. The systemwill also need to track total revenues generated
by medical care appointments and total expenditures for items purchased through wholesale vendors as well as enabling direct mail marketing of
targeted patients. For customers upon request it would need to provide itemized yearly lists of medical care (appointment) expenses and also
prescription purchases for income tax reporting purposes. For the pharmacy at the medical centers the systemwould need to automatically
generate prescription numbers and prices and record all information associated with the filing of the prescription, generate prescription labels and
patient receipts for the medications dispended, and generate detailed customer receipts (appointment or prescription) for insurance claims when
applicable. Also, it must generate a daily dispended drug log and a separate log of dispensed controlled substances, which must be kept to meet
DPR and DEA requirements. Also, to generate drug reorder reports for items that have fallen below their minimum stock amounts, help prevent
pharmacist and nurse licenses fromexpiring without being noticed.
5. Data Dictionary
Employee Entity
Entity Description: Personnel employed by the FirstCare Medical Center. No employee works at more than one center.
ColumnName ColumnDescription Data
Type
Data
Format
Field
Size
Example Primary
Key
Nullable Unique FK References
Employee_ID A unique 5-digitidentifier
assignedtoeachemployee.
Integer ####### 7 12345 TRUE FALSE TRUE
EmployeeSSN A unique nine digitidentifier
issuedtoindividualsbythe Social
SecurityAdministration.
Varchar ###-##-#### 11 123-82-397 FALSE FALSE TRUE
EmployeeFirstName The employee’slegal firstname Varchar 50 John FALSE FALSE FALSE
EmployeeMiddleInitial The firstletterof an employee’s
middle name.
Varchar 1 A FALSE TRUE FALSE
EmployeeLastName The legal lastname of an
employee.
VarChar 50 Smith FALSE FALSE FALSE
EmployeeStreetAddress The streetaddressof an
employee’shome orapartment.
Varchar 60 275 Mount
Carmel
Avenue
FALSE FALSE FALSE
EmployeeCity The city where the employee’s
streetaddressislocated
Varchar 25 Hamden FALSE FALSE FALSE
EmployeeState The State where anemployee’s
residence islocated.
Varchar 2 CT FALSE FALSE FALSE
EmployeeZipCode A five digitpostal code issuedby
USPS,it determinesthe exact
geographical areaof an
employee’sresidence
Varchar 5 06492 FALSE FALSE FALSE
EmployeePhone A mobile andorlandline phone
numberthatcan be usedto
contact an employee.
Varchar (###)###-
####
14 (203)-518-
0000
FALSE FALSE FALSE
6. Physician Entity
EntityDescription:AnindividualcontractedbyFirstCare whoisqualifiedandlicensedtopractice medicine inthe state. Physiciansare notconsideredemployees
of FirstCare Medical, they are independent contractors.
ColumnName ColumnDescription Data
Type
Data
Format
Field
Size
Example Primary
Key
Nullable Unique FK
References
PhysicianDEANumber ID assignedtolicensedphysicians
by the Federal DrugEnforcement
Administration.The firstletteris
alwaysA or B and the second
letteristhe firstletterof the
physician’slastname.
Varchar AC####### AC####### TRUE FALSE TRUE
PhysicianFirstName The employee’sfull legal first
name.
Varchar 75 John FALSE FALSE FALSE
PhysicianLastName The last name of the physician. Varchar 25 Craig FALSE FALSE FALSE
PhysicianPagerNumber The Physician’sassignedpager
number.
Varchar ###-##-
####
11 932-33-
2934
FALSE FALSE TRUE
PhysicianSpecialty Branchesof medicine,which a
physicianisanexpert.
Varchar 50 Cardiology,
Orthopedist
FALSE FALSE FALSE
7. Patient Entity
Entity Description: The patients that come into be treated at FirstCare Medical Center.
ColumnName ColumnDescription Data
Type
Data
Format
FieldSize Example Primary Key Nullable Unique FK
References
PatientID A unique six digitidentifier
assignedonce toeach
patient.The firstdigit the
FirstCare centerthe patient
was firstseen.
Varchar 123456 6 123456 TRUE FALSE TRUE
PatientInsurnceStatus Yes or No Varchar Yes 3 Yes FALSE FALSE FALSE
PatientFirstName The personal andor legal
name usedbefore the last
name
Varchar 20 John FALSE FALSE FALSE
PatientLastName The surname of the patient Varchar Smith FALSE FALSE FALSE
PatientStreetName The streetaddressof the
patient’shome
Varchar 25 275
Mount
Carmel
Ave
FALSE FALSE FALSE
PatientCity The city where the patient
lives
Varchar 20 Hamden FALSE FALSE FALSE
PatientState The state where the
patientlives
Varchar 2 CT FALSE FALSE FALSE
PatientZipCode The zip code of where the
patientlives
Varchar 5 06518 FALSE FALSE FALSE
PatientPhoneNumber The phone numberof the
patienteithermobile or
landline.
Varchar 10 (203) 123-
4434
FALSE FALSE FALSE
8. Nurse Entity
Entity Description: Registered nurse that FirstCare employs. FirstCare keeps track of the employee’s RN license number and expiration date to
ensure they don’t expire. The license needs to be renewed every two years.
ColumnName ColumnDescription Data
Type
Data
Format
Field
Size
Example Primary Key Nullable Unique FK
References
NurseLicNumber A personwhoistrainedand
licensedtocare for the sickor
infirm
Varchar RN####### 9 123-82-397 TRUE FALSE TRUE
NurseLicExpDate Nurse’slicenseexpirationdate Date YYYY-MM-
DD
2013-02-12 FALSE FALSE FALSE
MedCenterID The centerwhere the nurse is
assignedtowork.
Varchar 1 3 FALSE FALSE TRUE MedCenter
Entity
EmployeeID A unique 5digitidentifierassigned
to each employee.
Integer ###### 5 12345 FALSE FALSE TRUE Employee
Entity
Pharmacist Entity
Entity Description: On site employee who is licensed and authorized to fill prescriptions for patients of FirstCare Medical
ColumnName ColumnDescription Data
Type
Data
Format
Field
Size
Example Primary Key Nullable Unique FK
References
PharmacistLicNumber A nine characteralpha-numeric
identifierassignedbythe
Departmentof Professional
Regulation. ItstartswithPS.
Varchar PS####### 9 123-82-397 TRUE FALSE TRUE
PharmacistLicExpDate The Pharmacist’sLicense Expiration
date
Date YYYY-MM-
DD
2014-02-14 FALSE FALSE FALSE
MedCenterID The centerwhere the nurse is
assignedtowork.
Varchar 1 3 FALSE FALSE TRUE MedCenter
Entity
EmployeeID A unique 5digitidentifierassigned
to each employee.
Integer ###### 5 12345 FALSE FALSE TRUE Employee
Entity
9. Prescription Entity
Entity Description: Prescription order filled by a pharmacist for a patient as prescribed by a physician.
ColumnName ColumnDescription Data
Type
Data
Format
Field
Size
Example Primary
Key
Nullable Unique FK
References
PrescriptionID Starts withthe lettersignifying
whichof the centerpharmacies
filledthe prescription.(A=1,
B=2, C=3, D=4) followedbya
five digitsequential number
Varchar A##### 6 A00003 TRUE FALSE TRUE
PrescriptionInstructions Instructionsonuse forthe
prescription
Varchar 100 Apply
topical
cream to
chest
only.
FALSE FALSE FALSE
PrescriptionQuantity Numberof the drugs dispensed. Varchar XXX FALSE FALSE FALSE
PrescriptionPriceCharged Wholesale costof the
medicationplusa$3 dispensing
fee.Formedicationsthatdonot
require aprescription,the price
iswholesale costplus30%.
Varchar $XXXX.XX FALSE FALSE FALSE
DrugNDCNumber A numberassignedbydrug
manufacturersthatshows the
manufacturercode,product
code,and package code.
Varchar 11 1234-
5678-911
TRUE FALSE TRUE Drug Entity
PatientID Patientthatthe prescriptionis
beingfilledfor
Varchar 6 PatientEntity
PhysicianDEANumber ID assignedtolicensed
physiciansbythe Federal Drug
EnforcementAdministration.
The firstletterisalwaysA or B
and the secondletteristhe first
letterof the physician’slast
name.
Varchar AC####### AC#####
##
FALSE FALSE TRUE Physician
Entity
PharmacistLicNumber A unique setof numberthat
Identifythe pharmacist
Varchar 9 Pharmacist
Entity
10. Drug Entity
Entity Description: Description of drugs carried by the FirstCare Medical Centers pharmacy
ColumnName ColumnDescription Data
Type
Data
Format
Field
Size
Example Primary Key Nullable Unique FK
References
DrugNDCNumber A numberassignedbydrug
manufacturersthatshowsthe
manufacturercode,productcode,
and package code.
Varchar 11 1234-5678-
911
TRUE FALSE TRUE
DrugNameStrength The drug name and strength Varchar Drug name,
strength
25 Zoloft, 50
mg
FALSE FALSE FALSE
DrugUse Antibiotic,analgesic,
antihypertensive,etc.
Varchar 25 Antibiotic FALSE FALSE FALSE
DrugLegalClass LabeledasOTC, prescriptiononly,
controlled substance (subclass
listed)
Varchar N-# 3 C-2 FALSE FALSE FALSE
DrugAWP Each drug’s average wholesale
price
Decimal FALSE FALSE FALSE
DrugUnit Tablet,gram,milliliter,etc Decimal (10,2) mg FALSE FALSE FALSE
DrugSize Package size Decimal (10,2) 25 FALSE FALSE FALSE
DrugActualQty How muchof eachdrug is instock
at any time.
Integer 5 30 FALSE FALSE FALSE
DrugInvenMin The minimumlevelof eachdrug
that mustbe instock at all times.
Integer 5 20 FALSE FALSE FALSE
11. DrugOrder Entity
Entity Description: Drug orders sent to vendors for FirstCare Medical Center’s pharmacies
ColumnName ColumnDescription Data
Type
Data
Format
Field
Size
Example Primary Key Nullable Unique FK
References
DrugOrderID An alpha-numericidentifier
assignedtoeachorder
Varchar # - #### 1-1234 TRUE FALSE TRUE
DrugOrderCost Cost of the drug order. Money 4 FALSE FALSE FALSE
DrugOrderDate Date the drugsare ordered. Date MM-DD-
YYYY
2014-12-02 FALSE FALSE FALSE
DrugOrderQty The numberof packagesof each
drug that isordered.
Integer FALSE FALSE FALSE
DrugOrderDeliveredQty The numberof packagesof each
drug delivered
Integer FALSE FALSE FALSE
DrugOrderArrivalDate The date that the dug order
arrived.
Date MM-DD
YYYY-
11 2015-12-09 FALSE FALSE FALSE
DrugOrderActualCost The actual cost of the drug order. Money FALSE FALSE FALSE
VendorID Each vendorisassigneda unique,
sequential,VendorIDnumber.
Varchar N# TRUE FALSE TRUE Vendor
Entity
Vendor Entity
Entity Description: Information about the Vendors used to fill Drug Orders.
Column Name Column Description Data Type Data Format Field
Size
Example Primary Key Nullable Unique FK References
VendorID Each vendor is assigned a unique,
sequential,Vendor ID number.
Varchar N# TRUE FALSE TRUE
VendorName The company name of the
vendor.
Varchar NNNNN 30 Johnson
Drug
Company
FALSE FALSE FALSE
VendorPhoneNumber The vendor’s phone number Varchar ### - ### -
####
12 293-483-
4839
FALSE FALSE FALSE
VendorFaxNumber The vendor’s fax number Varchar ### - ### -
####
12 223-342-
4928
FALSE FALSE FALSE
12. MedicalCenter Entity
Entity Description: Building where health care, research, staff support, and ancillary services are provided.
ColumnName ColumnDescription Data
Type
Data
Format
Field
Size
Example Primary
Key
Nullable Unique FK References
MedCenterID Each of the four FirstCare centershas
a unique CenterIDnumbered1-4
Varchar 1 4 TRUE FALSE TRUE
MedCenterName The name of the medical center Varchar 30 Alcoa FirstCare
Medical Center
FALSE FALSE FALSE
MedCenterAddress The physical addressof the medical
center.
Varchar 25 35 Smith
Street, West
Palm, FL
FALSE FALSE FALSE
MedCenterPhone The medical center’sphone number Varchar 12 641-348-8837 FALSE FALSE FALSE
AdminID A unique nine digitidentifierissuedto
the administratorof eachmedical
center.Each centerhas onlyone
administrator
Varchar ##-#### 5 34631 FALSE FALSE TRUE Administrator
Entity
Administrator Entity
Entity Description: Each center has one administrator for each center.
ColumnName ColumnDescription Data Type Data Format Field
Size
Example Primary
Key
Nullable Unique FK References
AdminID Administrator’sIDthatisunique to
them
Varchar 5 TRUE FALSE TRUE
AdminJobTitle Specificjobtitle (manager,clerk,
receptionist,etc)
Varchar 20 FALSE FALSE FALSE
EmployeeID A unique 5-digitidentifierassigned
to each employee.
Integer ####### 7 12345 FALSE FALSE TRUE Employee Entity
MedCenterID The MedCenterIDof whichthe
Administratorworks
Varchar 1 3 FALSE FALSE FALSE MedicalCenter
Entity
13. Appointment Entity
Entity Description: Appointments made by patients to be seen at FirstCare Medical Center
ColumnName ColumnDescription Data Type Data
Format
Field
Size
Example Primary Key Nullable Unique FK
References
ApptID The firstdigitisthe centernumber
the appointmentwasmade for
and the nextsix digitsare assigned
sequentially.
Varchar 1234567 7 1234567 TRUE FALSE TRUE
ApptDuration The durationof the appointment Varchar 50 2 15 minutes FALSE FALSE FALSE
ApptTime The time of the appointment.
Appointmentsare made inhalf
hour increments
Time HH:MM:
SS
01:12:00 FALSE FALSE FALSE
ApptCharge Typical fixedfee ofrappointmet is
$35. Sometimesthe center
managermay increase fee fora
longerthantypical appointment.
All deesare the direct
responsibilityof the patient.
smallmoney $XXX.XX 3 $35 FALSE FALSE FALSE
ApptReason Reasonwhythe patientis
schedulingthe appointment.
Varchar 50 Sore
throat,
stuffy nose
FALSE FALSE FALSE
PatientID A unique six digitidentifier
assignedonce toeach patient.The
firstdigit the FirstCare centerthe
patientwasfirstseen.
Varchar 123456 6 123456 FALSE FALSE TRUE Patient
Entity
PhysicianDEANumber ID assignedtolicensedphysicians
by the Federal DrugEnforcement
Administration.The firstletteris
alwaysA or B and the second
letteristhe firstletterof the
physician’slastname.
Varchar AC#####
##
AC####### FALSE FALSE TRUE Physician
Entity
14. Assignment Entity
Entity Description: The assignments each Physician has for the day.
ColumnName ColumnDescription Data
Type
Data Format Field
Size
Example Primary Key Nullable Unique FK
References
AssignmentID A unique 7digitnumberthat
identifieseachphysician’sdaily
assignment.Theycanbe assigned
to more than one medcenterper
day.
Integer ####### 7 1234567 TRUE FALSE TRUE
AssignmentDate The date of the physician’s
assignments
Date YYYY-MM-DD 2014-12-
01
FALSE FALSE FALSE
AssignmentStart The start time of the assignment Time HH:MM:SS 10:30:00 FALSE FALSE FALSE
AssignmentEnd The time the assignmentshould
be finished.
Time HH:MM:SS 11:00:00 FALSE FALSE FALSE
MedCenterID The medical center’sID(numbers
1-4)
Varchar 1 1 FALSE FALSE FALSE Medical
Center Entity
PhysicianDEANumber ID assignedtolicensedphysicians
by the Federal DrugEnforcement
Administration.The firstletteris
alwaysA or B and the second
letteristhe firstletterof the
physician’slastname.
Varchar AC####### 9 AC12345
67
TRUE FALSE TRUE Physician
Entity
15. SQL Transact
Queries (A-H) - TestCaseson FirstCare Medical Center’sNewDatabase Management System.
Below were some of the test cases utilized by the systemdevelopers, where a set of conditions were employed to test the database and its
functionality in the FirstCare Medical business environment. These tests gave the developers insight and answered the question: did the new
system fulfill the business requirements outlined by Mr. Slate and FirstCare Medical, and are the features developed working at their optimum level?
To be assured that all business requirements were met, our systemdesign team decided that it would be best to perform at least two test cases on
each functional requirement.
If you (Mr. Slate) or any member of your team or organization has any questions or concerns about the new system, please do not hesitate to
contact us. It was a great pleasure working with FirstCare and we truly hope that we fulfilled your business needs.
Query A- Use ofan Aggregate Function
Case: Shannon in the billing department needs to submit a claimto the insurance company. The claimis for Norma Howard, a regular patient at
FirstCare. Her PatientID is 123458. Please find the amount she was billed for each appointment, and the PhysicianDEANumber /s of the Doctor /s
who treated her.
16. What is the total dollar amount of the claim we must submit to Aetna?
Marissa’s Unique Query
To meet growing demand for FirstCare Medical services, Mr. Slate is planning on opening another medical center. His team needs to know the total
number of licensed physicians and pharmacists that are currently on staff.
Query B- Usesan Outer Join
The DEA has accused a FirstCare Medical physician of illegally prescribing Xanax for his friends and not his patients. They look to do a complete and
thorough investigation and charge this individual while withholding their name from the public. The DEA has ordered FirstCare to provide a list of
all patients treated at the facility; including the drugs they have been prescribed. The agency has stated that they will carefully analyze medical
record to find and any strange discrepancies. Please provide the DEA with the information they request.
17. Query C- Joins at least 3 tables
Richard’smotherLawandais onthe phone andwantsto knowthe name and the strengthof the drugthat her sonwasprescribed.She justgotfromher son’s
camp counselorthatherson isbehavingerraticallyandshe knowsit’snotlike himanditmustbe somethingthatone of our Physiciansgave him.Pleaseresearch
the drug Richardwas prescribed.She doesn’tthe name of the physicianhersonsaw,butshe doesknowthat hispatientIDnumberis ‘123456’. We cannot
affordanotherlawsuit,please findthe name,strengthandlegal class of the drugprescribed.
18. It seems it wasn’t the medication, Richard has problems.
Query D- Uses a sub query
When trying to use the system, it is essential to note that sub queries can be used as alternatives to joins. Below are cases of how this applies.
What is the First and Last name of the Patient with the ID Number 123488?
19. Well Mr. George Perkins is furious; he’s on the phone right now with a secretary demanding to speak to Mr. Slate. He says that he has been a
patient with FirstCare Medical Center since we opened and is claiming that we charged him an outlandish fee, far more than we charged anyone
else for a short 25-minute consultation. Is this true, did we really charge Mr. Perkins, one of our most loyal customers more than anyone else?
Mr. Slater would like to get in touch with the Physician who treated Mr. Perkins. Please find the name and pager number for the Doctor, Mr. Slater
needs to meet with him/ her in his office immediately.
Query E- Uses a SQL Function
SELECT PatientID from Patient Where PatientLastName Like ‘J%’ or PatientFirstName Like ‘J5’;
20. Query F- Contains at least 5 conditions
Yale University is doing a study on certain the insurance demographics in certain. They are reaching out to FirstCare Medical Center for data to use
within their research. They want to know the names and phone numbers of all uninsured patients located in HI or MI, live between zip codes 10000
and 80000, and also have their last name begin with the letter "M".
22. Query H- Creates a trigger
When pharmacists dispense medication, then need to update Drug levels for inventory purposes. This triggers an update.
SQL Trigger Code:
create trigger trigger_t09
on Prescription after insert
as
update Drug
set DrugActualQty= DrugActualQty- (select PrescriptionQty from inserted)
where Drug.DrugNDCNnumber =(select DrugNDCNnumber from inserted);
alter table Drug
alter column DrugActualQty decimal (10, 2);
alter table prescription
alter column PrescriptionQty decimal (10, 2);
alter table drug
alter column DrugInvMin decimal (10, 2);
select * from prescription
insert into Prescription
23. values ('#00999E', 'dont take with alcholo', 10 ,41.64, '66715-6843', '123459', 'XV123456', 14268);
SELECT * FROM DRUG
WHERE DrugNDCNnumber= '66715-6843'
Davian’s Query
Tyreik’s Query
The process of how drugs get administered by health care facilities has recently fascinated the Quinnipiac University Poll. They would like to know
what are top 10 most common drugs that are prescribed more than their average and the amount each how been prescribed.
CREATE VIEW PrescriptionsAbove Average AS
SELECT PrescriptionID,PrescriptionQuantity
FROMPrescription
WHERE PrescriptionQuantity>(SELECTAVG(PrescriptionQuantity)FROMPrescription);
CREATE VIEW top ten AS
SELECT PrescriptionID
FROM [Prescription Above Average]
Where PrescriptionQuantity>(SELECT top 10 FROM Prescription)
GROUP BY PrescriptionQuantity;
24. Joe’s Query
FirstCare Medical Center is under investigation by the DEA for illegally distributing Adderall, the only AntiHyper Intensive Drug they prescribe. The
DEA wants to know the first name, last name, and employee id of any pharmacist who placed an order for adderall with an average wholesale price
above $7000.
Table Definitions
Thissectionincludesthe code of all tablescreated,droppedandmodified.
25. Create Table Employee (
EmployeeIDvarchar(50) primarykeynot null,
EmployeeSSN varchar(100) UNIQUE not null,
EmployeeFirstName varchar(70) not null,
EmployeeMiddleInitial varchar(4),
EmployeeLastName varchar(70) not null,
EmployeeStreetAddressvarchar(100) not null,
EmployeeCityvarchar(100) notnull,
EmployeeStatechar(2) not null,
EmployeeZipvarchar(15) notnull,
EmployeePhonevarchar(30) notnull,
);
Create Table Pharmacist(
PharmacistLicNumvbervarchar(30) primarykeynot null,
PharmacistExpDate DATEnotnull,
EmployeeIDvarchar(50) not null,
foreignkey(EmployeeID) referencesEmployee (EmployeeID),
);
Create Table Physician(
PhysicianDEANumbervarchar(30) primarykeynotnull,
PhysicianNamevarchar(25) not null,
PhysicianLastName varchar(25) not null,
PhysicianPagerNumbervarchar(11) not null,
PhysicianSpecialtyvarchar(30) not null,
);
Create table MedicalCenter(
MedCenterIDintprimarykeynotnull,
MedCenterName varchar(30) notnull,
AdminIDvarchar(5) not null,
MedCenterAddressvarchar(25) not null,
MedCenterPhone varchar(12) not null,
foreignkey(AdminID) referencesAdministrator(AdminID),
);
Create table Administrator(
AdminIDvarchar(5) primarykeynotnull,
AdminJobTitle varchar(20) notnull,