Mapping
Mapping
Pharmacies
This table stores pharmacy information, including their unique ID and contact details.
Attribute Data Type Length Constraints Null Description
Name
Phar_ID CHAR 5 Primary Key, NOT NULL Unique
Not Null identifier for
the
pharmacy
Name VARCHAR 20 Not Null NOT NULL Name of the
pharmacy
Address VARCHAR 50 Not Null NOT NULL Address of
the
pharmacy
Fax VARCHAR 50 Optional NULL Fax number
(Can be of the
Null) pharmacy
(optional)
Employees
This table stores employee data, indicating which pharmacy each employee works at.
Attribute Data Type Length Constraints Null Description
Name
Employee_I CHAR 5 Primary Key NOT NULL Unique
D (with identifier for
Phar_ID), the
Not Null employee
Phar_ID CHAR 5 Foreign Key NOT NULL ID of the
→ pharmacy
Pharmacies, where the
Not Null employee
works
Name VARCHAR 20 Not Null NOT NULL Employee
name
Drug_Manufacturers
This table stores details about drug manufacturing companies, including their address.
Attribute Data Type Length Constraints Null Description
Name
Company_ID CHAR 5 Primary Key, NOT NULL Unique
Not Null identifier for
the drug
manufacturer
Name VARCHAR 20 Not Null NOT NULL Name of the
company
Address VARCHAR 50 Not Null NOT NULL Company
address
Drugs
This table lists the available drugs and links each drug to its manufacturer.
Attribute Data Type Length Constraints Null Description
Name
Trade_Name VARCHAR 20 Primary Key (with NOT Trade name
Company_ID), Not NULL of the drug
Null
Company_ID CHAR 5 Foreign Key → NOT ID of the
Drug_Manufacturers, NULL manufacturer
Not Null
Doctors
This table stores doctor details, their specialties, and the drugs they prescribe.
Attribute Data Type Length Constraints Null Description
Name
Doctor_ID CHAR 5 Primary Key NOT NULL Unique
(with identifier for
Trade_Name), the doctor
Not Null
Trade_Name VARCHAR 20 Foreign Key NOT NULL Drug
→ Drugs, Not prescribed
Null by the
doctor
D_Name VARCHAR 20 Not Null NOT NULL Doctor name
Speciality VARCHAR 30 Not Null NOT NULL Doctor
specialty
Patients
This table stores patient information, including contact details, insurance info, and their
doctor.
Attribute Data Type Length Constraints Null Description
Name
PID CHAR 5 Primary Key NOT NULL Unique
(with identifier for
Doctor_ID), the patient
Not Null
Doctor_ID CHAR 5 Foreign Key NOT NULL Doctor
→ Doctors, treating the
Not Null patient
Name VARCHAR 20 Not Null NOT NULL Patient
name
Gender CHAR 1 Not Null NOT NULL Gender (M
or F)
Address VARCHAR 50 Not Null NOT NULL Patient
address
Contact_No VARCHAR 20 Not Null NOT NULL Contact
number
Insurance_Inf VARCHAR 30 Optional NULL Insurance
o (Can be information
Null) (optional)
Contracts
This table shows contracts between pharmacies and drug manufacturers, with start and end
dates.
Attribute Data Length Constraints Null Description
Name Type
Phar_ID CHAR 5 Primary Key (with NOT NULL Pharmacy ID
Company_ID), Not
Null
Company_ID CHAR 5 Foreign Key → NOT NULL Manufacturer
Drug_Manufacturers, ID
Not Null
Start_Date DATE - Not Null NOT NULL Contract
start date
End_Date DATE - Not Null NOT NULL Contract end
date
Work
This table manages employee work shifts in pharmacies.
Attribute Data Type Length Constraints Null Description
Name
Phar_ID CHAR 5 Primary Key NOT NULL Pharmacy ID
(with
Employee_ID)
, Not Null
Employee_I CHAR 5 Foreign Key → NOT NULL Employee ID
D Employees,
Not Null
Shift_Start DATE - Not Null NOT NULL Shift start
date
Shift_End DATE - Not Null NOT NULL Shift end
date
Sells
This table lists drugs sold by pharmacies along with their prices.
Attribute Data Type Length Constraints Null Description
Name
Phar_ID CHAR 5 Primary Key NOT NULL Pharmacy ID
(with
Trade_Name),
Not Null
Trade_Name VARCHAR 20 Foreign Key NOT NULL Drug name
→ Drugs, Not
Null
Price INT - Not Null NOT NULL Price of the
drug
Prescribe_Drug_And_Patient
This table tracks drugs prescribed to patients, including the date and quantity.
Attribute Data Type Length Constraints Null Description
Name
PID CHAR 5 Primary Key NOT NULL Patient ID
(with
Trade_Name),
Not Null
Trade_Name VARCHAR 20 Foreign Key NOT NULL Drug name
→ Drugs, Not prescribed
Null
Date DATE - Optional (Can NULL Date of
be Null) prescription
(optional)
Quantity INT - Not Null NOT NULL Quantity
prescribed
Prescribe
This table manages prescriptions issued by doctors, including date and quantity.
Attribute Data Type Length Constraints Null Description
Name
Doctor_ID CHAR 5 Primary Key NOT NULL Doctor ID
(with
Trade_Name),
Not Null
Trade_Name VARCHAR 20 Foreign Key NOT NULL Drug name
→ Drugs, Not
Null
Date DATE - Not Null NOT NULL Prescription
date
Quantity INT - Not Null NOT NULL Quantity
prescribed