ER-Diagram Explanations
ER-Diagram Explanations
-ER-DIAGRAM EXPLANATIONS-
Customer entity set: Customer entity set defines the people who buy drugs from pharmacy.
Customer entity set is identified by 5 simple attributes and 1 complex attribute which are
customer_id,first_name,last_name,age,gender, and address respectively. All attributes except from
address are simple, address attribute is a composite attribute which has three components. Two of
the address’s components are simple, namely city and state attributes. Street component is also
composite attribute which consists of street_no,street_name, and apt_no (which defines apartment
number) simple attributes. Primary key of Customer entity set is customer_id.
Pharmacy entity set: Pharmacy entity set defines the places where drugs are sold to customers.
Pharmacy entity set is identified by 2 simple attributes and 1 complex attribute which are
pharmacy_id,pharmacy-name, and pharmacy_address respectively. All attributes apart from the
pharmacy_address are simple, pharmacy_address attribute is a composite attribute which has three
components. Two of these attributes are simple, namely city and state. Street component is also
composite attribute whose components are street_no,street_name,apt_no (which defines apartment
number) simple attributes. Primary key of Pharmacy entity set is pharmacy_id.
Pharmacist entity set: Pharmacist entity set defines the workers who work in pharmacies.
Pharmacist entity set is identified by 5 simple attributes and 1 complex attribute which are
pharmacist_id,first_name,last_name,age,gender, and pharmacist_address respectively. All attributes
except from the pharmacist_address are simple, pharmacist_address attribute is a composite
attribute which has three components. Two of pharmacist_address’s components are simple, namely
city and state attributes. Street component is also composite attribute that comprise of
street_no,street_name, and apt_no simple attributes. Primary key of Pharmacist entity set is
pharmacist_id.
Doctor entity set: Doctor entity set defines the people who write prescriptions to customers in
order to allow them to buy drugs from pharmacies. Doctor entity set is identified by 3 simple
attributes which are doctor_id,doctor_name, and speciality respectively. Primary key of Doctor
entity set is doctor_id.
Drug Manufacturer entity set: Drug Manufacturer entity set defines companies which are
responsible for producing drugs and shipping them to pharmacies. Drug Manufacturer entity set is
identified by 2 simple attributes and 1 complex attribute which are manufactured_id,
manufacturer_name, and manufacturer_address respectively. All attributes apart from the
manufacturer address are simple, manufacturer_address attribute is a composite attribute which has
two components. All of these components are simple attributes, namely city and state. Primary key
of Drug Manufacturer entiy set is manufacturer_id.
Purchase entity set: Purchase entity set defines drug purchases made by customers from
pharmacies. Purchase entity set is identified by 3 simple attributes which are
purchase_id,purchase_amount, and purchase_date respectively. Primary key of Purchase entity set
is purchase_id.
2
Drug entity set: Drug entity set defines medicines that are bought by customers from pharmacies .
Drug entity set is a weak entity set because drugs cannot exist without any drurg manufacturer, so
existence of drugs is dependent on drug manufacturers. Drug weak entity set is identified by 3
simple discriminator attributes which are drug_id,drug_name,drug_category.
-RELATIONSHIP SETS-
buy_drug relationship set: buy_drug relationship set defines the relationship between Customer
entity set and Drug weak entity set. Customer entities have total participation on the
buy_drug_relationship set which means each customer buys a drug from any pharmacy. Drug
entities have partial participation on the buy_drug relationship set which means that there may be
some drugs which are not bought by some customers or more than one drug can be bought by
customers.
sell_drug relationship set: sell_drug relationship set defines the relationship between Pharmacy
entity set and Drug weak entity set. Pharmacy entities have total participation on the sell_drug
relationship set which means that each pharmacy sells drugs. Drug entities have partial participation
on the sell_drug relationship set which means that there may be some drugs that are not sold in any
pharmacy.
3
produce_drug relationship set: produce_drug relationship set defines the relationship between
Drug Manufacturer entity set and Drug weak entity set. Drug manufacturer entities have total
participation on the produce_drug relationship set which means that each drug manufacturer must
produce drugs. Participation of drug entities is indicated by cardinality constraint label (1..1) which
means that each drug is produced in some drug manufacturer , and any particular drug can only be
produced by a single drug manufacturer. Descriptive attributes of relationship set produce_drug are
production_date, and expiration_date.
NOTE: representing relationship sets which connect strong entity sets to weak entity sets in the
relational schema is not needed as the same attributes are already in included in the weak entities
relational schema.
-USERS OF SYSTEM-
• pharmacists
• doctors
• drug manufacturers