You are on page 1of 4

Pharmacy Shop Management System

Entities (Basic components of Pharmacy shop management system)


Pharmacy, Employee, Customer, Prescription, Payment, Medicine and Supplier

Attributes of each Entity


1) Pharmacy: - PharName, PharAdress, PharCity, PharPostalcode, pharStreet, PharHNo, PharType,
EmpID.
2) Employee:- EmpID, EmpFname, EmpLname, EmpAge, EmpSex, EmpDoB, EmpMobilePhone,
EmpWorkPhone, EmpAddress, EmpCity, EmpSubcity, EmpHNo, EmpSalary, EmpPossition,
CustID.
3) Customer:- CustID, CustFname, CustLname, CustAge, CustDoB, CustAddress, CustCity,
CustSubcity, CustHNo, CustType, CustMobilePhone, PreID.
4) Prescription: - PreID, PreName, PreDate, PreDose, PreDescription, PreMedicine, PayID.
5) Payment :- PayID, PayDate, PayAmount, PayType, PayName, ProductID.
6) Product:- ProductID, ProExpDate, ProMfgDate, ProType, ProQnt, ProPrice, ProAmount,
SupID.
7) Supplier: - SupID, SupName, SupType, SupAdress, SupEmail, SupCity, SupStreet, SupHNo,
SupPhone, SupDescription, PharName.

 Primary keys: - the attributes of each entity that are underlined attributes.
 Foreign keys: - the attributes that are both bolded and italicized.

 Composite Attributes: -
o PharAdress [Pharmacy],
o EmpAddress [Employee],
o CustAddress [Customer] and
o SupAdress[Supplier]

 Multivalued attributes:
o EmpMobilePhone( EmpMobilePhone1, EmpMobilePhone2,…)
o SupPhone (SupPhone2, SupPhone1, …) and
o CustMobilePhone (CustMobilePhone1, CustMobilePhone2,…)

 Derived Attribute:
 EmpAge [derived from EmpDoB]
Cardinality
1. A single pharmacy can have multiple employees. Thus, the relation between
them is one to many.
2. A single employee can handle multiple customers. Thus, the relation between
them is one to many.
3. A single customer can hold multiple prescriptions. Thus, the relation between
them is one to many.
4. A single prescription can only make a single payment. Thus, the relation between
them is one to one.
5. A single payment can order multiple products, but a single product can only be
ordered by a single payment. Thus, the relation between them is one to many.
6. multiple products can be supplied by a single Supplier. Thus, the relation
between them is many to one.
7. One supplier can be contacted by multiple pharmacy branches and one
pharmacy branch can contact multiple suppliers. Thus, the relation between
them is many to many.

Normalization 3NF
 Avoid multivalued attributes: - EmpMobilePhone, SupPhone, CustMobilePhone but instead
add attributes on Employee (EmpMobilePhone1 and EmpMobilePhone2), on Supplier
(SupPhone1, SupPhone2) and on Customer (CustMobilePhone 1, CustMobilePhone2)
 Avoid composite attributes: - PharAdress, EmpAddress, CustAddress, SupAdress.
 Avoid derived attributes: - EmpAge [derived from EmpDoB].
 Avoiding transitive dependency
1. Normalization Table for Pharmacy: -

Pharmacy (PharName, PharCity, PharPostalcode, pharStreet, PharHNo, PharType,


EmpID).

Field (Attributes Data Types Field Constan NULL / Default value


Name) Size t NOT NULL
PharName Varchar 25 PK NOT NULL
PharCity Varchar 25 NOT NULL Addis Ababa
PharPostalcode Varchar 15 NOT NULL
pharStreet Char 15 NOT NULL
PharHNo Char 5 NOT NULL
PharType Char 15 NOT NULL
EmpID Char 9 FK NULL

2. Normalization for Employee: -


Employee (EmpID, EmpFname, EmpLname, EmpSex, EmpDoB, EmpMobilePhone1,
EmpMobilePhone2, EmpWorkPhone, EmpCity, EmpSubcity, EmpHNo, EmpSalary,
EmpPossition, CustID).

Field (Attributes Data Field Constant NULL / Default value


Name) Types Size NOT NULL
EmpID Char 9 PK NOT NULL
EmpFname Varchar 25 NOT NULL
EmpLname Varchar 25 NOT NULL
EmpDoB Date NOT NULL
EmpMobilePhone1 Char 17 NOT NULL
EmpMobilePhone2 Char 17 NULL
EmpWorkPhone Char 17 NOT NULL
EmpCity Varchar 25 NOT NULL Addis Ababa
EmpSubcity Varchar 25 NOT NULL
EmpHNo Varchar 5 NOT NULL
EmpSalary Money NULL
EmpPossition Char 25 NOT NULL
CustID Char 9 FK NULL

3. Normalization for Customer: -

Customer (CustID, CustFname, CustLname, CustAge, CustCity, CustSubcity, CustHNo,


CustType, CustMobilePhone1, CustMobilePhone2, PreID).

Field (Attributes Data Field Constant NULL / Default value


Name) Types Size NOT NULL
CustID Char 9 PK NOT NULL
CustFname Varchar 25 NOT NULL
CustLname Varchar 25 NOT NULL
CustAge Int NOT NULL
CustMobilePhone1 Char 17 NOT NULL
CustMobilePhone2 Char 17 NULL
EmpWorkPhone Char 17 NOT NULL
CustCity Varchar 25 NOT NULL Addis Ababa
CustSubcity Varchar 25 NOT NULL
CustHNo Varchar 5 NOT NULL
CustType char 15 NOT NULL
PreID Char 9 FK NULL

4. Normalization for Prescription: -

Prescription  (PreID, PreName, PreDate, PreDose, PreDescription, PreMedicine, PayID.)


Field (Attributes Data Types Field Constan NULL / Default value
Name) Size t NOT NULL
PreID Char 9 PK NOT NULL
PreName Varchar 25 NOT NULL
PreDate Date NOT NULL
PreDose Char 15 NOT NULL
PreDescription Varchar 5 NOT NULL
PreMedicine Varchar 15 NOT NULL
PayID Char 9 FK NULL

5. Normalization for Prescription: -

Payment  (PayID, PayDate, PayAmount, PayType, PayName, ProductID)


Field (Attributes Data Types Field Constan NULL / Default value
Name) Size t NOT NULL
PayID Char 9 PK NOT NULL
PayDate Date NOT NULL
PayAmount Money NOT NULL
PayType Varchar 15 NOT NULL
PayName Varchar 5 NULL
ProductID Char 9 FK NULL

You might also like