0% found this document useful (0 votes)
9 views

dbms report1

The document outlines the design and implementation of a Pharmacy Database Management System (PDMS) aimed at automating pharmacy operations, including customer transactions, drug inventory, and supplier management. It details the project's objectives, key features, and benefits, along with a comprehensive ER diagram that illustrates the relationships between various entities like customers, employees, sales, and drugs. The system is designed to enhance data accuracy, reduce errors, and improve overall efficiency in pharmacy operations.

Uploaded by

Viñay K R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

dbms report1

The document outlines the design and implementation of a Pharmacy Database Management System (PDMS) aimed at automating pharmacy operations, including customer transactions, drug inventory, and supplier management. It details the project's objectives, key features, and benefits, along with a comprehensive ER diagram that illustrates the relationships between various entities like customers, employees, sales, and drugs. The system is designed to enhance data accuracy, reduce errors, and improve overall efficiency in pharmacy operations.

Uploaded by

Viñay K R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

PHARMACY DATABASE MANAGEMENT SYSTEM

Prepared for: Prof. Mohammad Abdussami

SCHOOL OF Engineering & Technology


CSE 2nd year
SRM University AP,
Mangalagiri Mandal,
Guntur – 522502

Report By:
Akileswar Reddy-AP23110011515
Karthik-AP23110011481
Muktesh Naidu-AP23110011476
Vishnu Vardhan-AP23110011483

Submitted on
TABLE OF CONTENTS

 Project Background……………………………………………………………………3
 Description of the Project……………………………………………………………...4
 Objective
 Overview
 Key Features
 Database Design
 Benefits
 ER Diagram…………………………………………………………………………...6
 Description of ER diagram…………………………………………………………....7
 Conversion of ER diagram into tables………………………………………….……..8
 Description of Tables……………………………………………………………..…...9
 Normalization of tables up to 3-NF……………………………………………….…10
 SQL queries…….……………………………………………………………….……11
 Joins
 Aggregate functions
 Grouping
 Subqueries
 Creation of views using tables…………………………………………………….…15
 References...………………………………………………………………………….17
Project Background

In today’s fast-paced healthcare environment, the efficient management of pharmaceutical


data is critical for ensuring accuracy, accountability, and seamless service delivery. A
Pharmacy Database Management System (PDMS) plays a vital role in organizing, storing,
and retrieving information related to drug inventory, suppliers, sales, manufacturers,
customers, and employees.
This project aims to design and implement a robust Pharmacy Database Management System
that automates and streamlines the operations of a pharmacy. The proposed system captures
essential data through an entity-relationship (ER) model which forms the foundation for
database structure.
The ER diagram illustrates how various entities such as Customers, Employees, Sales, Drugs,
Manufacturers, and Suppliers interact within the system. It ensures that every sale is recorded
with relevant customer and employee information, each drug is associated with its
manufacturer and purchase details, and inventory levels are tracked accurately. The
relationships between entities ensure data consistency and support critical business operations
such as processing sales, managing stock, and recording supplier transactions.

By implementing this system, a pharmacy can benefit from:


 Better stock control and tracking of drug availability.
 Accurate sales and purchase records.
 Efficient handling of supplier and manufacturer data.
 Enhanced customer service through detailed tracking.
 Reduced human error and improved data reliability.

This Pharmacy Database Management System is designed to be scalable and adaptable to the
growing needs of modern pharmacies, offering a reliable digital solution for pharmaceutical
data handling
Description of the Project

Objective:
The Pharmacy Database Management System is designed to efficiently manage the
operations of a pharmacy by handling customer transactions, drug inventory, employee
records, supplier interactions, and sales processes. This project aims to develop a robust and
scalable system that ensures accurate data storage, retrieval, and analysis for pharmacy
operations.
Overview:
Pharmacy management involves complex processes such as drug procurement, inventory
tracking, customer sales, and supplier management. Manual handling of these processes often
leads to errors, redundancy, and data loss. This project automates these tasks through a
relational database system that ensures data integrity, supports fast retrieval, and simplifies
pharmacy administration.
Key Features:
 Customer Management:
Stores customer details including ID, name, and contact information.
 Employee Management:
Records employee information such as name, age, gender, salary, and employee ID.
 Sales Module:
Tracks sales made by employees to customers, including sale date, total amount, and sale
details.
 Drug Inventory:
Manages data related to drugs including name, location, available quantity, price, expiry
date, and category.
 Supplier & Purchase Management:
Maintains records of suppliers and details of drug purchases including quantities and
dates.
 Manufacturer Details:
Keeps information about drug manufacturers, their names, and addresses.
 Sales Details:
Provides detailed records of each sale including the drugs sold, their quantities, and
prices.
Database Design:
The system is modeled using an Entity-Relationship (ER) diagram which is translated into
relational tables. The design is normalized up to the Third Normal Form (3NF) to eliminate
redundancy and ensure data integrity. The tables include entities such as Customer,
Employee, Sale, Drug, Manufacturer, Supplier, Sale_Details, and Purchases, each with
appropriate primary and foreign key constraints.

Benefits:
 Accurate and secure data management
 Reduced manual effort and error
 Faster query processing and reporting
 Better inventory and sales tracking
 Easy scalability and integration with pharmacy software systems
The Pharmacy Database Management System improves the efficiency and reliability of
pharmacy operations by organizing and automating the data handling processes. It serves as a
foundational model for pharmacy software solutions and can be extended with features like
billing systems, stock alerts, and analytics dashboards.
Entity Relationship Diagram (ER Diagram)
Description of ER diagram

The provided Entity-Relationship (ER) diagram represents a pharmaceutical sales


management system. It is designed to capture the essential entities and relationships involved
in the process of manufacturing, purchasing, and selling drugs. The primary entities in this
system are Customer, Sale, Employee, Drug, Manufacturer, Suppliers, and Sale_details. The
Customer entity contains attributes such as customer ID, name, and contact, and each
customer can make multiple sales. The Sale entity includes attributes like sale ID, sale date,
and total amount. Each sale is made by a customer and is processed by one or more
employees. The Employee entity consists of employee ID, name, salary, age, and sex,
indicating who is responsible for handling the sales.

A sale contains various drugs, and this relationship is detailed through the Sale_details entity,
which serves as a bridge between Sale and Drug and includes attributes such as quantity and
total price. The Drug entity holds information like drug ID, name, available quantity,
location, price per unit, expiry date, and category. Drugs are manufactured by manufacturers,
represented by the Manufacturer entity that includes the manufacturer name, ID, and address.
Furthermore, drugs are purchased from Suppliers, an entity that includes supplier ID, name,
email, and phone number. The purchase relationship contains additional details such as
purchase quantity and purchase date.

Overall, this ER diagram effectively illustrates the interactions between different components
of a pharmaceutical system, supporting processes from manufacturing and supplying to
selling and managing customer data. It ensures clear relationships between entities and
provides a robust framework for storing and managing pharmaceutical transaction records.
Conversion of ER diagram into tables

Based on the ER diagram, the following tables are created:


1. Customer Table
 Attributes: customerid, Name, Contact
2. Employee Table
 Attributes: EMPID, Name, Salary, Age, Sex
3. Sale Table
 Attributes: SaleID, Total_amount, SaleDate, customerid, EMPID
4. Drug Table
 Attributes: Drugid, Name, Location, Price_per_unit, Available_Quantity, Expi
ry_date, Category, Manufacturerid
5. Manufacturer Table
 Attributes: Manufacturerid, Mname, Address
6. Sale_details Table
 Attributes: SaleID, Drugid, Quantity, Total_price
7. Suppliers Table
 Attributes: supplierid, Supplier_name, Email, Phno
8. Purchases Table
 Attributes: Drugid, supplierid, PQuantity, PDate
Description of Tables
Based on the ER diagram, the following tables have been created to represent the structure
and relationships within a pharmaceutical sales management system. Each table is designed
to store specific types of data, ensuring efficient organization and easy retrieval of
information.
1. Customer Table:
This table stores the details of customers who make purchases. It includes attributes such as
customerid (Primary Key), Name, and Contact. This data helps in identifying and
communicating with customers.
2. Employee Table:
The employee table holds information about the staff responsible for processing sales.
Attributes include EMPID (Primary Key), Name, Salary, Age, and Sex.
3. Sale Table:
This table records every sale transaction. It includes SaleID (Primary Key), Total_amount,
SaleDate, and foreign keys customerid and EMPID to track which customer made the
purchase and which employee processed it.
4. Drug Table (druginfo & inventory):
This table holds detailed information about drugs. Attributes include Drugid (Primary Key),
Name, Location, Price_per_unit, Available_Quantity, Expiry_date, Category, and
Manufacturerid (Foreign Key). It combines both general details and inventory status of each
drug.
5. Manufacturer Table:
Stores data related to drug manufacturers. Attributes are Manufacturerid (Primary Key),
Mname, and Address. This table links to the drug table to show which manufacturer produces
which drug.
6. Sale_details Table:
Acts as a junction table between the Sale and Drug tables. It contains SaleID, Drugid (both
Foreign Keys), Quantity of the drug sold, and the Total_price for that specific item in the sale.
7. Suppliers Table:
Maintains records of drug suppliers. Attributes include supplierid (Primary Key),
Supplier_name, Email, and Phno. This data is useful for procurement and vendor
management.
8. Purchases Table:
This table tracks drug purchases from suppliers. It includes Drugid, supplierid (both Foreign
Keys), the quantity purchased (PQuantity), and the purchase date (PDate).
Normalization of tables up to 3-NF
Normalization ensures data integrity and eliminates redundancy by splitting tables where
necessary.
1. Normalized Customer Table
 Attributes: Same as original (customerid, Name, Contact)
2. Normalized Employee Table
 Attributes: Same as original (EMPID, Name, Salary, Age, Sex)
3. Normalized Sale Table
 Attributes: Same as original
(SaleID, Total_amount, SaleDate, customerid, EMPID)
4. Normalized Drug Table
Split into two tables:
 Drug Basic Info Table:
 Attributes: Drugid, Name, Location, Price_per_unit
 Drug Inventory Table:
 Attributes: Drugid (Foreign
Key), Available_Quantity, Expiry_date
5. Normalized Manufacturer Table
 Attributes: Same as original (Manufacturerid, Mname, Address)
6. Normalized Sale_details Table
 Attributes: Same as original (SaleID, Drugid (Foreign Key), Quantity, and
Total_price)
7. Normalized Suppliers Table
 Attributes: Same as original (supplierid, Supplier_name, Email, Phno)
8. Normalized Purchases Table
 Attributes: Same as original (Drugid (Foreign Key), supplierid (Foreign Key),
PQuantity, PDate)
9. Normalized Manufactures Table
 Attributes: Same as original (Manufacturerid (Foreign Key), Drugid (Foreign
Key))

SQL queries
Joins:
1. Customer and their sales
SELECT c.Name, s.SaleID, s.Total_amount, s.SaleDate
FROM customer c
JOIN sale s ON c.customerid = s.customerid;

2. Sale details with drug info


SELECT sd.SaleID, d.Name AS DrugName, sd.Quantity, sd.Total_price
FROM sale_details sd
JOIN druginfo d ON sd.Drugid = d.Drugid;

3. Drugs and their manufacturers


SELECT d.Name AS DrugName, m.Mname AS Manufacturer
FROM druginfo d
JOIN manufacturer_connection mc ON d.Drugid = mc.Drugid
JOIN manufacturer m ON mc.Manufacturerid = m.Manufacturerid;

4. Employee-wise sales
SELECT e.Name AS Employee, s.SaleID, s.Total_amount
FROM employee e
JOIN sale s ON e.EMPID = s.EMPID;

5. Inventory details with drug name


SELECT d.Name, i.Available_Quantity, i.Expiry_date
FROM inventory i
JOIN druginfo d ON i.Drugid = d.Drugid;
Aggregate Functions:
1.Total sales made
SELECT SUM(Total_amount) AS TotalRevenue FROM sale;

2.Average drug price


SELECT AVG(Price_per_unit) AS AveragePrice FROM druginfo;

3.Minimum and Maximum drug price


SELECT MIN(Price_per_unit) AS MinPrice, MAX(Price_per_unit) AS MaxPrice FROM
druginfo;

4.Count of drugs in each category


SELECT Category, COUNT(*) AS DrugCount
FROM druginfo
GROUP BY Category;

5. Total quantity sold of each drug


SELECT Drugid, SUM(Quantity) AS TotalQty
FROM sale_details
GROUP BY Drugid;
Grouping:
1. Sales grouped by customer
SELECT customerid, COUNT(*) AS TotalSales, SUM(Total_amount) AS AmountSpent
FROM sale
GROUP BY customerid;

2. Drug inventory grouped by expiry


SELECT Expiry_date, COUNT(*) AS DrugCount
FROM inventory
GROUP BY Expiry_date;
3. Number of drugs per manufacturer
SELECT m.Mname, COUNT(mc.Drugid) AS DrugCount
FROM manufacturer m
JOIN manufacturer_connection mc ON m.Manufacturerid = mc.Manufacturerid
GROUP BY m.Mname;

4. Employees and number of sales


SELECT EMPID, COUNT(*) AS SalesHandled
FROM sale
GROUP BY EMPID;

5. Drug sales grouped by category


SELECT d.Category, SUM(sd.Quantity) AS TotalQty
FROM sale_details sd
JOIN druginfo d ON sd.Drugid = d.Drugid
GROUP BY d.Category;
Subqueries
1. Drugs with price above average
SELECT * FROM druginfo
WHERE Price_per_unit > (SELECT AVG(Price_per_unit) FROM druginfo);

2. Customers who made high value sales


SELECT DISTINCT customerid FROM sale
WHERE Total_amount > (SELECT AVG(Total_amount) FROM sale);

3. Drugs never sold


SELECT Name FROM druginfo
WHERE Drugid NOT IN (SELECT DISTINCT Drugid FROM sale_details);

4. Employees who sold more than 1 sale


SELECT EMPID FROM sale
GROUP BY EMPID
HAVING COUNT(*) > 1;

5. Get the most expensive drug


SELECT * FROM druginfo
WHERE Price_per_unit = (SELECT MAX(Price_per_unit) FROM druginfo);
Creation of views using tables
1. Create view of drug summary
CREATE VIEW DrugSummary AS
SELECT Drugid, Name, Category, Price_per_unit
FROM druginfo;

2. Create view of expired drugs


CREATE VIEW ExpiredDrugs AS
SELECT i.Drugid, d.Name, i.Expiry_date
FROM inventory i
JOIN druginfo d ON i.Drugid = d.Drugid
WHERE i.Expiry_date < CURDATE();

3. Create view for employee performance


CREATE VIEW EmployeeSales AS
SELECT e.EMPID, e.Name, SUM(s.Total_amount) AS TotalSales
FROM employee e
JOIN sale s ON e.EMPID = s.EMPID
GROUP BY e.EMPID, e.Name;

4.View for purchase details


CREATE VIEW PurchaseDetails AS
SELECT p.Drugid, d.Name AS DrugName, p.PQuantity, p.PDate
FROM purchases p
JOIN druginfo d ON p.Drugid = d.Drugid;

5.View showing top 3 most sold drugs


CREATE VIEW TopDrugs AS
SELECT sd.Drugid, d.Name, SUM(sd.Quantity) AS TotalSold
FROM sale_details sd
JOIN druginfo d ON sd.Drugid = d.Drugid
GROUP BY sd.Drugid, d.Name
ORDER BY TotalSold DESC
LIMIT 3;
References
Offline References (Books):
1. "Database System Concepts" by Abraham Silberschatz, Henry Korth, and S. Sudarshan
A widely recommended academic textbook with thorough coverage of ER models and
advanced database concepts.
2. "Fundamentals of Database Systems" by Ramez Elmasri and Shamkant Navathe
Detailed book with a dedicated chapter on ER diagrams, used in many university courses.
3. "Database Management Systems" by Raghu Ramakrishnan and Johannes Gehrke
Excellent for both theory and practical examples, including ER modeling.
4. "Simplified Approach to DBMS" by Parteek Bhatia
Student-friendly with simplified explanations and plenty of examples and diagrams.

Online References:
1. GeeksforGeeks – ER Model
Website: geeksforgeeks.org
Explanation with diagrams, types of relationships, and ER components.
2. TutorialsPoint – DBMS ER Model
Website: tutorialspoint.com
Simple explanations with visuals and examples.
3. W3Schools – DBMS ER Diagram
Website: w3schools.com
Good for beginners with step-by-step concepts.
4. YouTube Channels
Gate Smashers and Neso Academy offer great video tutorials on ER diagrams and DBMS
concepts.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy