You are on page 1of 46

COLLEGE OF ENGINEERING AND TECHNOLOGY

DEPARTMENT OF COMPUTER SCIENCE


INTRODUCTION TO DATABASE SYSTEM (COSC)
: PHARMACY MANAGEMENT SYSTEM

Number ID Number
Name
First Name Last Name
1 ENYEW MEKETE RU/0635/14
2 AYANA GEBREYESUS RU/3560/14
3 YOHANNIS YENEAKAL RU/1731/14
4 DAWIT SOLOMON RU/0506/14
5 BETELHEM GETNET RU/1801/14

1
Table of content
CHAPTER: 1 Introduction
1.1 introduction ………………………………………………………………………………. 3
1.2 Feasibility study …………………………………………………... ………………… 5
1.2.1 Operational feasibility ……………………………………………….5
1.2.2 Technical feasibility ………………………………………………………7
1.2.3 Cost/Benefits ……………………………………………………………..…7
1.3 System Analysis ………………………………………………………………………..…… 9
1.4 System requirements
1.4.4 Hardware requirement ……………………………………………10
1.4.2 Software requirement ……………………………………………10
1.5 Data flow Diagram …………………………………………………………………….…. 11

CHAPTER: 2 Conceptual Designs


2.1 Entity Relationship ………………………………………………………………………………12
2.2 Attribute with their Description Patient ……………………………………………….12
2.3 Relationship between the Entities ……………………………………………………… 16
2.4 4 ER-Diagram ………………………………………………………………………………………. 18
2.5 Mapping ER diagram to relational model …………………………………………….. 19
2.6 Stored Procedure…………………………………………………………………………………21
2.7 Authentication and Authorization………………………………………………………22
2.8 Data Dictionary ……………………………………………………………………………………..23

CHAPTER: 3 Logical Designs


3.1 Validating model with Normalization………………………………………………………. 224
3.2 Applying SQL statement …………………………………………………………………….....24
3.3 First Normal form (1NF) ………………………………………………………………………..25
3.4 Second Normal Form (2NF) ………………………………………………………………………28
3.5 Third Normal Form ………………………………………………………………………………… 29
3.6 Relational schema with referential integrity after normalization ……………..30

CHAPTER: 4 Physical database designs


4.1 Physical database design ………………………………………………………………………….31

4.2 Implementation and Testing …………………………………………………………………..32

4.3 Defining SQL Server backup and restore …………………………….34


4.4 Conclusion………………………………………………………………………………38

2
4.5 Reference……………………………………………………………………………….39

CHAPTER: 1
INTRODUCTION
Pharmacy Database Management System
1.1 Introduction

The main aim of the project is the management of the database of the
Pharmaceutical shop. This is done by creating a database of the
available medicines in the shop. The database is then connected to the
main program by using interconnection of the Visual Basic program
and the database already created.

1.1.1 Specific Objectives:


Inventory Management: Create a system to manage the inventory of
pharmaceutical products, including tracking stock levels, expiration
dates, and supplier information.

3
2. Sales and Billing: Implement a module to facilitate smooth
transactions, generate invoices, and manage billing for products sold
to customers.
3. Prescription Management: Develop functionality to handle
prescriptions, including recording prescription details, linking them to
specific patients, and maintaining a record of prescribed medications.
4. Supplier Management: Enable the system to manage details of
pharmaceutical suppliers, including contact information, product
catalogs, and past transactions.
5. Customer Management: Implement a feature to maintain a
customer database, store customer purchase history, and manage
customer profiles and prescription records.
6. Reporting and Analytics: Provide tools for generating reports on
sales, inventory levels, and financial summaries. This can help in
making informed decisions and identifying trends.
7. Security and Access Control: Ensure the system is equipped with
access controls, authentication mechanisms, and data encryption to
safeguard sensitive information.

1.1.2 General Objectives:


1. Efficiency Improvement: Streamline operations and reduce manual
effort in managing inventory, sales, and customer records.
2. Accuracy and Consistency: Ensure accurate and consistent
management of inventory, prescriptions, and customer data to
minimize errors and improve service quality.

4
3. Compliance and Regulatory Adherence: Help the pharmacy adhere
to industry regulations, such as record-keeping requirements,
prescription handling, and inventory management practices.
4. Enhanced Customer Service: Improve customer service through
better prescription management, quick and accurate billing, and
efficient service delivery.
5. Data Security and Integrity: Safeguard sensitive customer and
prescription data, ensuring confidentiality and compliance with data
protection regulations.
6. Business Insight and Decision Support: Provide tools for analyzing
sales, inventory turnover, and customer behavior to aid in strategic
decision-making and operational planning.
7. Scalability and Adaptability: Design the system to be scalable,
allowing for future expansion of features and adaptability to changes
in the pharmacy's operations.

These specific and general objectives pave the way for the successful
development and implementation of a pharmacy management system.
Clear objectives help in guiding the development process, ensuring
that the system meets the requirements of the pharmacy and its
stakeholders.

If you have any specific inquiries regarding the development of such a


system or need further details on any of the objectives, feel free to
ask!

5
Application:

This program can be used in any pharmaceutical shops having a


database to maintain. The software used can generate reports, as per
the user’s requirements. The software can print invoices, bills,
receipts etc. It can also maintain the record of supplies sent in by the
supplier

6
1.2 Feasibility Study

A feasibility analysis involves a detailed assessment of the need,


value and practicality of a proposed enterprise, such as systems
development. The process of designing and implementing record
keeping systems has significant accountability and resource
implications for an organization. Feasibility analysis will help you
make informed and transparent decisions at crucial points during the
developmental process to determine whether it is operationally,
economically and technically realistic to proceed with a particular
course of action.

Most feasibility studies are distinguished for both users and


analysts. First, the study often presupposes that when the feasibility
document is being prepared, the analyst is in a position to evaluate
solutions. Second, most studies tend to overlook the confusion
inherent in system development – the constraints and the assumed
attitudes.

1.2.1 Operational feasibility


People are inherently resistant to change, and computers have
been known to facilitate change. An estimate should be made of how
strong a reaction the user staff is likely to have toward the

7
development of a computerized system. It is common knowledge that
computer installations have something to do with turnover, transfers,
retraining, and changes in employee job status. Therefore, it is
understood that the introduction of a candidate system requires special
effort to educate, sell and train the staff on new ways of conducting
business.

8
1.2.2 Technical feasibility

Technical feasibility centres around the existing computer system


(hardware, software, etc.) and to what extend it can support the
proposed addition. For example, if the current computer is
operating at 80 per cent capacity – an arbitrary ceiling – then
running another application could overload the system or require
additional hardware. This involves financial considerations to
accommodate technical enhancements. If the budget is a serious
constraint, then the project is judged not feasible.

1.2.3 Cost/ Benefit analysis

Economic analysis is the most frequently used method for

evaluating the effectiveness of a candidate system. More commonly

known as cost benefit analysis, the procedure is to determine the

benefits and savings that are expected from a candidate system and

compare them with costs. If benefits overweigh costs, then the

decision is made to design and implement the system. Otherwise,

further justification or alterations in the proposed system will have

to be made if it is to have a chance of being approved. This is an

9
on-going effort that improves in accuracy at each phase in the

system life cycle.

Costs:

 Cost of new computer approximately Rds. 22,000/-


 Cost of operating system approximately Rds. 5000/-

Benefits:
 Avoids tedious typing task
 Faster document retrieval
 Saving storage space
 Keeps data secure
 Easy to use, update and maintain

10
1.3 System Analysis

It is the most creative and challenging phase of the system life cycle.
The analysis phase is used to design the logical model of the system
whereas the design phase is used to design the physical model.

Many things are to be done in this phase .we began the


designing process by identifying forms, reports and the other outputs
the system will produce. Then the specify data on each were
pinpointed. we sketched the forms or say, the displays, as expected to
appear, on paper, so it serves as model for the project to begin finally
we design the form on computer display, using one of the automated
system design tool, that is VISUAL BASIC 6.0.

After the forms were designed, the next step was to specify the
data to be inputted, calculated and stored individual data items and
calculation procedure were written in detail. File structure such as
paper files were selected the procedures were written so as how to
process the data and procedures the output during the programming
phase. The documents were design ion the form of charts.

Output design means what should be the format for presenting


the results. It should be in most convenient and attractive format for
the user. The input design deals with what should be the input to the
system and thus prepare the input format. File design deals with how
the data has to be stored on physical devices. Process design includes

11
the description of the procedure for carrying out operations on the
given data.

1.4 System Requirements

The system services and goals are established by consultation with


system user. They are then defined in details and serve as a system
specification. System requirement are those on which the system runs.

1.4.1 Hardware Requirements:

 Computer with either Intel Pentium processor or AMD


processor.
 128MB DDR RAM
 40GB hard disk drive
1.4.2 Software Requirements:

 Windows 98/2000/XP operating system.


 Microsoft Office package.
 Microsoft Visual Studio 6.0
1.5 Data Flow Diagrams

 A data flow diagram is a graphical representation or technique depicting information

flow and transform that are applied as data moved from input to output. The DFD are

partitioned into levels that represent increasing information flow and functional

details. The processes, data store, data flow, etc. are described in Data Dictionary.

12
13
CHAPTER: 2
CONCEPTUAL DESIGN
Data Dictionary
2.1 Entity with their description:
 Patients: represents individuals who receive medication from the pharmacy.

 Prescriptions: represents the doctor's orders for medication for a patient.

 Medications: represents the drugs that the pharmacy stocks and dispenses.

 Doctor: represents a person who sees and wrote a prescription for the patient.

 Suppliers: represents the entities that provide medications to the pharmacy.

 Employees: represents the people who work at the pharmacy.

 Customer: represents a person who visits the pharmacy.

 Pharmacy: this entity represents the pharmacy itself.

2.2 Attributes with their description Patients:


 Patient-ID: id of the patient which describes the patient uniquely.

 Name: the name of the patient.

 Date of Birth: the patient's date of birth.

 Address: the patient's address.

 Phone Number: the patient's phone number.

14
 Insurance Information: the patient's insurance information.

 Doctor-ID: foreign key of patient entity.

Prescriptions:

 Prescription-ID: id of the prescription which is primary key of prescription.

 Patient: the name of the patient for whom the prescription was written.

 Medication: the name of the medication that the prescription is for.

 Dosage: the dosage of the medication.

 Frequency: how often the medication should be taken.

 Customer-ID: foreign key of prescription.

 Employee-ID: foreign key of prescription.

 Patient-ID: foreign key of prescription entity.

Medications:

 Medication-ID: primary key of the medication.

 Name: the name of the medication.  Manufacturer: the name of the

manufacturer of the medication.

 Description: a description of the medication.

 Dosage: the standard dosage for the medication.

 Stock Quantity: the current quantity of the medication in stock.

 Price: the price of the medication.

 Supplier-ID: foreign key of mastication entity.

 Pharmacy-ID: foreign key of medication.

Customer:

 Customer-ID: a unique identifier for the customer entity.

 Address: represents customers address.

15
 Name: the name who represents the customer.

 Phone number: the phone address of the customer.

Suppliers:

 Supplier-ID: primary key of the supplier.

 Name: the name of the supplier.

 Address: the supplier's address.

 Phone number: the supplier's phone number.

Employees:

 Employee-ID: id of the employee which is primary key of the employee.

 Name: the name of the employee.

 Position: the employee's position at the pharmacy.

 Date Hired: the date when the employee was hired.

 Phone number: the employee's phone number.

 Email: the employees email address.

 Pharmacy-ID: foreign key of an employee.

Pharmacy:

 Pharmacy-Id: id of the pharmacy which is a primary key.

 Name: the name of the pharmacy.

 Address: location of the pharmacy.

 Phone number: the phone address of the pharmacy.

Doctor:

 Doctor-ID: id of the physician which is primary key of the doctor.

 Name: name of the doctor.

 Speciality: the specific profession the doctor specialized.

16
 E- mail: email address of the doctor.

 Phone number: phone address of the doctor.

2.3 Relationship between the Entities

 Pharmacy:

 have customers

 contracts with supplier

 Stocks a medication.

 Employee:

 Works for pharmacy.

 Check prescriptions.

 Medication:

 Ordered to patients.

 Prescription:

 Prescribed a medication.

 Filled to the patients.

 Patient:

 Bought medication.

 Doctor:

 Sees the patients.

 Writes a prescription.

 Customer:

 Purchases a medication.

 Supplier:

17
 Supplies a medication.

 Also contracts with the pharmacy.

18
2.4 ER-Diagram

19
2.5 Mapping ER diagram to relational model

Patients:

Patient –ID Patient Date of Birth Address Pho-no Patient Doctor-ID


Name insurance

Employee:

Employee- Employee Position Date- Pho-no Email Pharm-ID


ID Name Tired

Customer:

Customer-ID Customer-Name Address Phone-no

Prescription:

Prescri Patien Medicatio Dosag Frequen Custom-ID Employee- Patient-ID


ption- t n e cy ID
ID

Medication:

Med- Sup- Name Manufacturer Description Dosage Stock Price Phar-


ID ID quality ID

Pharmacy:

Pharmacy-ID Pharmacy-Name Address Phone-no

Supplier:

Supplier-ID Name Address Phone-no

Doctor:

20
Doctor-ID Doctor Name Speciality Email Phone-no

CREATE DATABASE PHARMACY_MANEGMENT_SYSTEM


USE PHARMACY_MANEGMENT_SYSTEM

CREATE TABLE patient (


patient_id INT PRIMARY KEY,
name VARCHAR(255),
date_of_birth DATE,
address VARCHAR(255),
phone_number VARCHAR(20),
insurance VARCHAR(255),
doctor_id INT,
pharmacy_id INT,
FOREIGN KEY (doctor_id) REFERENCES doctor(doctorid),
FOREIGN KEY (pharmacy_id) REFERENCES pharmacy(pharmacyid)
);

INSERT INTO patient (patient_id, name, date_of_birth, address,


phone_number, insurance)
VALUES (001, 'Elsa Wondesen Abebe', '1983-06-25', 'DB, Kebele 07',
'0923164589', 'Yes),
(002, 'Ferehiwot Tamrat Tiruneh', '1995-07-16', 'Dessie,
Kebele 05', '0918030454', 'No),
(003, 'Abera Aschalew Kebede', '1989-04-09', 'Dessie, Kebele
10', '0978453442', 'Yes),
(004, 'Alemu Getachew Ayale', '1990-06-05', 'DB, Kebele 08',
'0978623944', 'Yes)
);

CREATE TABLE employee (


employee_id INT PRIMARY KEY,
name VARCHAR(255),
position VARCHAR(255),
date_hired DATE,
phone_number VARCHAR(20),
email VARCHAR(255),
pharmacy_id INT,
FOREIGN KEY (pharmacy_id) REFERENCES pharmacy(pharmacy_id)
);

INSERT INTO employee (employee_id, name, position, date_hired,


phone_number, email)
VALUES (01, 'Eden Solomon', 'DB', '02', '0983476213',
'Edensolomon1212@gmail.com'),

21
(02, 'Mered Demere', 'DB', '09', '0978543267',
'Mereddemere23@amail.com'),
(03, 'Eshetu Selamu', 'DB', '04', '0922456874',
'Eshetuselam7@gmail.com'),
(04, 'Yabsira Lema', 'DB', '06', '0918114354',
'Yebsiralema065@gmail.com')
);

CREATE TABLE customer (


customer_id INT PRIMARY KEY,
name VARCHAR(255),
address VARCHAR(255),
phone_number VARCHAR(20)
);

INSERT INTO customer (customer_id, name, address, phone_number)


VALUES (1, 'Meaza Yalew', 'DB, Kebele 04', '0967676767'),
(2, 'Yared Gizat', 'DB, Kebele 05', '0934256784'),
(3, 'Semira Ahmed', 'DB, Kebele 03', '0987341234'),
(4, 'Omar Kedir', 'DB, Kebele 09', '0912345678'));

CREATE TABLE medication (


medication_id INT PRIMARY KEY,
supplier_id INT,
name VARCHAR(255),
manufacturer VARCHAR(255),
description VARCHAR(255),
dosage VARCHAR(255),
stock_quality INT,
price DECIMAL(10, 2),
pharmacy_id INT,
FOREIGN KEY (supplier_id) REFERENCES supplier(supplier_id),
FOREIGN KEY (pharmacy_id) REFERENCES pharmacy(pharmacy_id)
);

INSERT INTO medication (medication_id, name, description, dosage,


stock_quality, price)
VALUES (001, 'Parastamol', 'Headache', '250', '50', '12 box'),
(002, 'Burfin', 'Headache, Toothache', '250', '100', '15
box),
(003, 'Amocsasilin', 'Antibiotc', '250,500', '58', '10 box),
(004, 'Ampicilin', 'Antibiotc', '250', '50', '7 box),
(005, 'Cefximene', 'Antibiotic', '250', '60', '5 box)
);
CREATE TABLE pharmacy (
pharmacy_id INT PRIMARY KEY,

22
name VARCHAR(255),
address VARCHAR(255),
phone_number VARCHAR(20)
);

INSERT INTO pharmacy (pharmacy_id, name, address, phone_number)


VALUES (1001, 'Yared Pharmacy', 'DB, Kebele 09', '059111234')
);

CREATE TABLE supplier (


supplier_id INT PRIMARY KEY,
name VARCHAR(255),
address VARCHAR(255),
phone_number VARCHAR(20)
);
INSERT INTO supplier (supplier_id, name, address, phone_number)
VALUES (1001, 'ZAF Pharmaceutical PLC', 'Addis Ababa',
'0916542345'),
(1002, 'Cadila Pharmaceutical PLC', 'Addis A BABA',
'0928458432'),
(1003, 'Bilham Pharmaceutical PLC', 'Addis Ababa',
'0981949596'),
(1004, 'Chief Drug Store', 'Diredaw', '0945676767')
);

CREATE TABLE doctor (


doctor_id INT PRIMARY KEY,
name VARCHAR(255),
specialty VARCHAR(255),
email VARCHAR(255),
phone_number VARCHAR(20)
);

INSERT INTO doctor (doctor_id, name, specialty, phone_number, email)


VALUES (01, 'Seifu Abeje', 'Cadiologist', '0911245697',
'Seifuabeje5665@gamail.com),
(02, 'Dsalegn Maru', 'Dermatiologist', '0956325369',
'Desalegnmaru7895@gamail.com),
(03, 'Selam Mohammed', 'Pthologist', '0942378694',
'Selammohammed3553@gamail.com)
);

2.6 Stored procedure


CREATE PROCEDURE customer
AS
BEGIN

23
SELECT * FROM tablecustomer;
END
CREATE PROCEDURE insert_customer
AS
BEGIN
INSERT INTO customer (name, address, phone)
VALUES ('Meaza Yalew', 'DB,Kebele 04', '0967676767'),
('Yared Gizat', 'DB,Kebele 05', '0934256784'),
('Semira Ahmed', 'DB,Kebele 03', '0987341234'),
('Omar Kedir', 'DB,Kebele 09', '0912345678');
END
EXEC insert_customer;

CREATE PROCEDURE insert_doctor


AS
BEGIN
INSERT INTO doctor (doctor_id, name, specialty, phone_number, email)
VALUES (01, 'Seifu Abeje', 'Cadiologist', '0911245697',
'Seifuabeje5665@gamail.com'),
(02, 'Dsalegn Maru', 'Dermatiologist', '0956325369',
'Desalegnmaru7895@gamail.com'),
(03, 'Selam Mohammed', 'Pthologist', '0942378694',
'Selammohammed3553@gamail.com');
END
EXEC insert_doctor;

CREATE PROCEDURE create_supplier


AS
BEGIN
CREATE TABLE supplier (
supplier_id INT PRIMARY KEY,
name VARCHAR(255),
address VARCHAR(255),
phone_number VARCHAR(20)
);

INSERT INTO supplier (supplier_id, name, address, phone_number)


VALUES (1001, 'zaf pharmaceutical plc', 'addis ababa', '0916542345'),
(1002, 'cadila pharmaceutical plc', 'addis a baba', '0928458432'),
(1003, 'bilham pharmaceutical plc', 'addis ababa', '0981949596'),
(1004, 'chief drug store', 'diredaw', '0945676767');
END
EXEC insert_supplier;

CREATE PROCEDURE create_pharmacy_table


AS
BEGIN
CREATE TABLE pharmacy (
pharmacy_id INT PRIMARY KEY,
name VARCHAR(255),
address VARCHAR(255),
phone_number VARCHAR(20)
);
INSERT INTO pharmacy (pharmacy_id, name, address, phone_number)
VALUES (1001, 'Yared Pharmacy', 'DB, Kebele 09', '059111234');
END
EXEC insert_pharmacy;

CREATE PROCEDURE create_medication


AS

24
BEGIN
CREATE TABLE medication (
medication_id INT PRIMARY KEY,
supplier_id INT,
name VARCHAR(255),
manufacturer VARCHAR(255),
description VARCHAR(255),
dosage VARCHAR(255),
stock_quality INT,
price DECIMAL(10, 2),
pharmacy_id INT,
FOREIGN KEY (supplier_id) REFERENCES supplier(supplier_id),
FOREIGN KEY (pharmacy_id) REFERENCES pharmacy(pharmacy_id)
);
INSERT INTO medication (medication_id, name, description, dosage, stock_quality,
price)
VALUES (001, 'Parastamol', 'Headache', '250', '50', '12 box'),
(002, 'Burfin', 'Headache, Toothache', '250', '100', '15 box'),
(003, 'Amocsasilin', 'Antibiotc', '250,500', '58', '10 box'),
(004, 'Ampicilin', 'Antibiotc', '250', '50', '7 box'),
(005, 'Cefximene', 'Antibiotic', '250', '60', '5 box');
END
EXEC insret_medication;

CREATE PROCEDURE create_patient


AS
BEGIN
CREATE TABLE patient (
patient_id INT PRIMARY KEY,
name VARCHAR(255),
date_of_birth DATE,
address VARCHAR(255),
phone_number VARCHAR(20),
insurance VARCHAR(255),
doctor_id INT,
pharmacy_id INT,
FOREIGN KEY (doctor_id) REFERENCES doctor(doctor_id),
FOREIGN KEY (pharmacy_id) REFERENCES pharmacy(pharmacy_id)
);
END
EXEC insert_patient;

2.7 Authentication and Authorization


2.8 Data Dictionary
Data Data
No of Description
item type
bytes Constraint
for
storage
ID int 3-7 Unique identifier Primary key
Fname String 3-20 First name of the Not NULL
member

25
Lname String 3-20 Last name of the Not NULL
member
D.O.B Date Birth date of the Not NULL
member
Addre 5-12 Location of the Not NULL
ss pharmacy
Phone int 10 Phone number Not NULL
no
Email varch 10-27 Email address Not NULL
ar
Data Dictionary outlining

CHAPTER :3
Logical Design
3.1 Validating model with Normalization
 Pharmacy

ID Name Address Phone no


1001 Yared Pharmacy DB,Kebele 09 059111234

 Supplier
Supplier ID Supplier Name Address Phone no
1001 ZAF Pharmaceutical Addis Ababa 0916542345
PLC
1002 Cadila Pharmaceutical Addis A BABA 0928458432
PLC
1003 Bilham Addis Ababa 0981949596
Pharmaceutical PLC
1004 Chief Drug Store Diredaw 0945676767

26
 Customer
Custom-ID Customer Address Phone-no
Name
1 Meaza Yalew DB,Kebele 04 0967676767

2 Yared Gizat DB,Kebele 05 0934256784

3 Semira Ahmed DB, ,Kebele 03 0987341234

4 Omar Kedir DB, ,Kebele 09 0912345678

27
 Patient
Patien Patient Date of Address Pho-no Insurance
t -ID Name Birth informatio
n
001 Elsa 25/06/1983 DB,Kebele 07 0923164589 Yes
Wondese
n Abebe
002 Ferehiwot 16/07/1995 Dessie,Kebele 0918030454 No
Tamrat 05
Tiruneh
003 Abera 09/04/1989 Dessie,Kebele 0978453442 Yes
Aschalew 10
Kebede
004 Alemu 05/06/1990 DB,Kebele 08 0978623944 Yes
Getachew
Ayale

 Medication
M
ed-
Name Descriptio Dosag Pric Stock Manufactu
ID n e e quanti rer
ty
00 Parastam Headache 250 50 12 box AA.P.M
1 ol
00 Burfin Headache,Tootha 250 100 15 box AD.P.M
2 che
00 Amocsasil Antibiotc 250,500 58 10 box AD.P.M
3 in
00 Ampicilin Antibiotc 250 50 7 box AA.P.M
4
00 Desprine Headache 100 100 8 box AD.P.M
4
00 Cefximen Antibiotic 250 60 5 box AA.P.M
5 e

 Doctor
Doctor- Doctor Name Speciality Phone- Email
ID DOC DOC Lname no
Fname

28
01 Seifu Abeje Cadiologist
0911245697 Seifuabeje5665@ga
mail.com
02 Dsalegn Maru Dermatiologist 0956325369 Desalegnmaru7895@
gamail.com
03 Selam Mohammed Pthologist 0942378694 Selammohammed35
53@gamail.com
04 Rediet Getaneh Orthopedist 0977456672 Redietgetaneh@gam 2/7
/20
ail.com 14

3.2 Applying SQL statement


 The SELECT statement is used to retrieve data from a database.
 SELECT Syntax
SELECT column1, column2, FROM table-name
 If you want to select all the fields available in the table, use the following
syntax:
Select *from person; SELECT column1, column2, FROM table name; SELECT
* FROM table name

 The UPDATE statement is used to update records in a table.


 SQL UPDATE Syntax
UPDATE table name SET column1=value, column2=value2,...
WHERE some column=some value;

 The DELETE statement is used to delete records in a table.


 The DELETE statement is used to delete rows in a table.
 SQL DELETE Syntax
DELETE FROM table name WHERE some column=some value;

 It is possible to delete all rows in a table without deleting the


table
DELETE FROM table name;
Or DELETE * FROM table name;
Or Truncate Table Table name;

29
3.3 First Normal form (1NF)
1NF of Pharmacy

ID Name A DDRESS Phone no


City Kebele
1001 Yared DB Kebele 0116814567
Pharmacy

1 NF of prescription
Prescription- Patient Medication Dosage(mg) Frequency
ID Patient Patient Patient
Fname Midname Lname
0001 Elsa Wondesen Abebe Panadol 250 Two times a
day
0002 Ferehiwot Tamrat Tiruneh Amocsasilin 100 3 times a day
0003 Abera Aschalew Kebede Ampcilin 500 Bede time
0004 Alemu Getachew Ayele Deprine 400 2 Times a
day

1 NF Supplier
Supplier-ID Supplier Name Address Phone number
1001 ZAF Pharmaceutical Addis Ababa 0916542345
PLC
1002 Cadila Addis Ababa 0928458432
Pharmaceutical PLC
1003 Bilham Addis Ababa 0981949596
Pharmaceutical PLC
1004 Chief Drug Store Diredawa 0945676767

1NF of Patient

Patient Patient f Patient Patie Dat city kebel Phone Insuranc


id name m nt e of e no e nofo
name Lnam birt

30
e h
001 Elsa Wondese Abebe 25/0 DB 07 092316458 Yes
n 6/19 9
83
002 Ferihioet Tamrat TIRUN 16/0 Dessi 05 091803045 No
EH 7/19 e 4
95
003 Abera Aschalew Kebed 09/0 Dessi 10 097845344 Yes
e 4/19 e 2
89
004 Alemu Getache Ayele 05/0 DB 08 097862394 Yes
w 6/19 4
90

1NF Customer
Custe CustOmer Name Address Phone no
mer-ID Customer-Fname CustomerMname City Kebele
1 Meaza Yalew DB 04 09676767

2 Yared GIZAT DB 05 0934256784


3 Semira Ahmmed DB 03 0987341234
4 Omar Kedir DB 09 0912345678

1NF of Medication
Medication Name Description Dosage Price
-ID
001 Parastamol Headache 250 50

31
002 Brufin Headache 250 100
002 Brufin Toothache 250 100
003 Amocsacilin Antibotic 250,500 58
004 Ampcilin Antibotic 250 50
004 Desprine Headache 100 100
005 Cefximene Antibotic 250 60

32
1NF of Doctor
Docto Doctor Name Speciality Phone no Email
r-ID Doctor Doctor
fname Lname
01 Seifu Abeje Cardiologist 091124569 Seifuabeje5665@gamail.com
7
02 Desaleg Maru Dermatologis 095632536 Desalegn7895@gamail.com
n t 9
03 Selam Mohamme Pathologist 094237869 Selammohammed@gamail.co
d 4 m
04 Rediet Getaneh Orthopedist 097745667 Redietgetaneh@gamail.com
2

1NF of Employee
Emp Empl Employe address Phone no E-Mail
loye oyee e lname cit Kebel
e ID fname y e
01 Eden Solomon DB 02 0983476213 Edensolomon1212@gmail.c
om
02 Mered Demere DB 09 0978543267 Mereddemere23@amail.com
03 Eshetu Selamu DB 04 0922456874 Eshetuselam7@gmail.com
04 Yabsira Lema DB 06 0918114354 Yebsiralema065@gmail.com

3.4 Second Normal Form (2NF)


2NF Employee
Employee info
Employee Employee Employee Position Date hired Phone no Email
ID fname lname

Employee Phar
Employee ID Pharmacy ID

33
2NF of Patient
Patient info
Patient ID Patient Patien Date of Address Phone no Patient
fname lname Birth insurance

Doctor info
Patient ID Doctor ID

3.5 Third Normal Form


3NF of Employee
Employee info

Employee Employee Employee Position Date hired Phone no Email


ID fname lname

Employee Phar
Employee ID Pharmacy ID

3NF of Patient
Patient info
Patient ID Patient Patien Date of Address Phone no Patient
fname lname Birth insurance

Doctor info
Patient ID Doctor ID

34
 Based on the above samples of 2NF & 3NF we can sketch
the others, but for now we should passed to the other scenario.

3.6 Relational schema with referential integrity


after normalization

Patient:
Patient ID Doctor ID

Employee:
Employee ID Pharmacy ID

Customer:
Customer ID Phone noID

Prescription:
Prescription ID Custom ID Employee ID Patient ID

Medication:
Medication ID Supplier ID Pharmacy ID

Pharmacy:
Pharmacy ID Pharmacy name

Supplier:
Supplier ID Phone no

35
Doctor:
Doctor ID Phone no

CHAPTER: 4
Physical database design
4.1 Physical database design

36
4.2 Implementation and Testing

37
38
39
40
41
4.3 Defining SQL Server backup and restore

The SQL Server backup and restore technique involves steps for creating
backups, restoring databases, and saving a valid backup copy in a different
location. It is a built in SQL Server feature, useful for disaster recovery plans.

The backup and restore process in SQL Server involves three main steps:
1. Backing up the desired SQL Server database
2. Transferring the backup files to another location, usually a remote
location to avoid risk of a hard drive failure along with possible software
problems (e.g. virus attacks)
3. Restoring the database on SQL Server to ensure that the database backup
is valid and to verify integrity.
Restoring a database backup will ensure that in case of a disaster, the restore
process will be successful with no errors or problems in general. The SQL
Server backup and restore process requires constant testing of backed up files to
provide reliable disaster recovery plan. If the backups are not being tested, they
might turn out to be bad files that can’t be used for data recovery.

42
43
44
4.4 Conclusion

 Detailed information gathering has to be done.


 Implementing the software requires change in the business practices.
 Efficient organization of all knowledge is the analysis company and easy
analysis access and retrieval of information is possible.
 In this project we have also included SQL statement
 Company using this software will always be able to plan in future and
always be aware of their financial position in the market.
 It leads to streaming of business processes.
 The implementation and maintenance costs run very high

45
4.5 Reference
 http://www.google.co.in
 http://www.wikipedia.com
 http://www.doi.org/10.2215/kej.2017.08.008

THE END!

46

You might also like