0% found this document useful (0 votes)
18 views5 pages

Sales Inventory Project Formatted

The Sales and Inventory System Project aims to manage product sales, stock levels, and inventory movement for small and medium businesses. It utilizes MySQL for database management and includes various entities such as products, suppliers, and sales transactions, represented in an E-R diagram. The project outlines table creation, data insertion commands, and sample queries for viewing inventory and sales summaries.

Uploaded by

nachiket.roy.2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

Sales Inventory Project Formatted

The Sales and Inventory System Project aims to manage product sales, stock levels, and inventory movement for small and medium businesses. It utilizes MySQL for database management and includes various entities such as products, suppliers, and sales transactions, represented in an E-R diagram. The project outlines table creation, data insertion commands, and sample queries for viewing inventory and sales summaries.

Uploaded by

nachiket.roy.2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Sales and Inventory System Project

Objective of the Project


The primary goal of the Sales and Inventory System is to manage and track
product sales, stock levels, and inventory movement. The system is designed to:

• Monitor product availability.


• Record sales transactions.
• Automate stock updates after each sale.
• Generate comprehensive reports on sales and inventory.

Target Audience
This system is primarily geared towards: - Small and medium businesses (retailers
and wholesalers) - Inventory managers - Sales personnel - Business owners
seeking real-time insights into sales and stock levels

Back End Tool


MySQL will serve as the back end for database management, handling: - Table
creation - Data insertion and manipulation using SQL queries

E-R Diagram
The system is composed of several entities and relationships:

• Category: Defines product categories.


• Product: Contains product details and is linked to both category and
supplier.
• Supplier: Stores supplier information.
• Inventory: Tracks stock quantities.
• Customer: Holds customer details.
• Sales: Records sales transactions.
• Sales_Details: Connects sales to products with quantities sold.

Below is a visual representation using Mermaid syntax:

erDiagram
CATEGORY {
int CategoryID PK "Primary Key"
string CategoryName
}
PRODUCT {
int ProductID PK "Primary Key"
string ProductName
int CategoryID FK "Foreign Key"
int SupplierID FK "Foreign Key"
decimal Price
}
SUPPLIER {
int SupplierID PK "Primary Key"
string SupplierName
string Contact
}
INVENTORY {
int ProductID PK "Primary Key"
int QuantityInStock
}
CUSTOMER {
int CustomerID PK "Primary Key"
string CustomerName
string Email
}
SALES {
int SaleID PK "Primary Key"
int CustomerID FK "Foreign Key"
date SaleDate
}
SALES_DETAILS {
int SaleDetailID PK "Primary Key"
int SaleID FK "Foreign Key"
int ProductID FK "Foreign Key"
int Quantity
}

CATEGORY ||--o{ PRODUCT : "includes"


SUPPLIER ||--o{ PRODUCT : "supplies"
PRODUCT ||--|| INVENTORY : "monitored by"
CUSTOMER ||--o{ SALES : "initiates"
SALES ||--o{ SALES_DETAILS : "comprises"
PRODUCT ||--o{ SALES_DETAILS : "featured in"
Implemented MySQL Tables and Commands
Table Creation

-- Create Category Table


CREATE TABLE Category (
CategoryID INT PRIMARY KEY AUTO_INCREMENT,
CategoryName VARCHAR(100) NOT NULL
);

-- Create Supplier Table


CREATE TABLE Supplier (
SupplierID INT PRIMARY KEY AUTO_INCREMENT,
SupplierName VARCHAR(100),
Contact VARCHAR(50)
);

-- Create Product Table


CREATE TABLE Product (
ProductID INT PRIMARY KEY AUTO_INCREMENT,
ProductName VARCHAR(100),
CategoryID INT,
SupplierID INT,
Price DECIMAL(10,2),
FOREIGN KEY (CategoryID) REFERENCES Category(CategoryID),
FOREIGN KEY (SupplierID) REFERENCES Supplier(SupplierID)
);

-- Create Inventory Table


CREATE TABLE Inventory (
ProductID INT PRIMARY KEY,
QuantityInStock INT,
FOREIGN KEY (ProductID) REFERENCES Product(ProductID)
);

-- Create Customer Table


CREATE TABLE Customer (
CustomerID INT PRIMARY KEY AUTO_INCREMENT,
CustomerName VARCHAR(100),
Email VARCHAR(100)
);

-- Create Sales Table


CREATE TABLE Sales (
SaleID INT PRIMARY KEY AUTO_INCREMENT,
CustomerID INT,
SaleDate DATE,
FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID)
);

-- Create Sales_Details Table


CREATE TABLE Sales_Details (
SaleDetailID INT PRIMARY KEY AUTO_INCREMENT,
SaleID INT,
ProductID INT,
Quantity INT,
FOREIGN KEY (SaleID) REFERENCES Sales(SaleID),
FOREIGN KEY (ProductID) REFERENCES Product(ProductID)
);

Data Insertion

-- Insert into Category


INSERT INTO Category (CategoryName) VALUES ('Electronics'), ('Groceries

-- Insert into Supplier


INSERT INTO Supplier (SupplierName, Contact) VALUES
('TechSupply Inc.', '9876543210'),
('FreshMart', '8765432109');

-- Insert into Product


INSERT INTO Product (ProductName, CategoryID, SupplierID, Price) VALUES
('Smartphone', 1, 1, 29999.99),
('Rice 5kg', 2, 2, 450.00);

-- Insert into Inventory


INSERT INTO Inventory (ProductID, QuantityInStock) VALUES
(1, 50),
(2, 100);

-- Insert into Customer


INSERT INTO Customer (CustomerName, Email) VALUES
('John Doe', '[email protected]');

-- Insert into Sales


INSERT INTO Sales (CustomerID, SaleDate) VALUES
(1, '2025-04-17');

-- Insert into Sales_Details


INSERT INTO Sales_Details (SaleID, ProductID, Quantity) VALUES
(1, 1, 2),
(1, 2, 3);
Sample Queries to View Data

-- View Inventory
SELECT * FROM Inventory;

-- View Sales Summary


SELECT s.SaleID, c.CustomerName, s.SaleDate, p.ProductName, sd.Quantity
FROM Sales s
JOIN Customer c ON s.CustomerID = c.CustomerID
JOIN Sales_Details sd ON s.SaleID = sd.SaleID
JOIN Product p ON sd.ProductID = p.ProductID;

You might also like