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

Cycle Shop Database

The document proposes a database for a cycle shop to better organize their business data. It identifies key entities like customers, employees, invoices, products, and suppliers. Attributes and relationships between entities are defined. An E-R diagram is created and the database is implemented in MySQL with tables for each entity and relationships defined by primary and foreign keys.
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)
45 views

Cycle Shop Database

The document proposes a database for a cycle shop to better organize their business data. It identifies key entities like customers, employees, invoices, products, and suppliers. Attributes and relationships between entities are defined. An E-R diagram is created and the database is implemented in MySQL with tables for each entity and relationships defined by primary and foreign keys.
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/ 19

1

Cycle Shop Database

Submitted by:
Muhammad Ihtisham
Mustaneer Haider
Shahab Shah

Supervised by:
Mr. Babar Zeb
2

Contents

Introduction.................................................................................................................................................3
Problems with existing Database.................................................................................................................4
Interviews to gather Information.................................................................................................................5
Mission Statement.......................................................................................................................................6
Mission Objectives......................................................................................................................................7
Identifying Entities......................................................................................................................................9
Identifying Attributes and Keys.................................................................................................................10
Identifying Relationship............................................................................................................................11
E-R Model.................................................................................................................................................14
Implementation in MySQL........................................................................................................................15
3

Introduction
"Cycling World Peshawar" is a cycle shop located in Peshawar, it has
been open for years. Ijaz, The owner of the shop has been conducting
his daily business on sheets of paper. he maintains information about
sales, employees, customers and suppliers on sheets of paper. Because
of this, Ijaz spend a lot of time in maintaining his data.
Recently, Ijaz learned that by using database he could easily store and
work with the data related to his business. Using database will also
reduce the time he spend on maintaining data and he can make sure
that the data is accurate and up-to-date.
4

Problems with existing Database


As we know that the shop owner is using a paper based database and
the problems he has been facing is almost same as with any other
paper based database approach.

here are some of the main problems faced by the shop owner:

1. It is time consuming because he spent most of his time in


maintaining his data.
2. It is difficult to have a Backup of his paper based database.
3. There is a Lack of Security, because his files can be lost.
4. The owner needs a lot of space to store his records.
5. It is hard for him to update or copy his records.
6. searching a specific record is difficult.
7. high Risk of human error.
8. Assurance of Data integrity is difficult.
9. High data redundancy

By using a computerized Database most of the above problems can be


solved and in addition to that, now the shop owner can quickly and
efficiently search for different records and also analyze his records to
make better business decision, now the owner can quickly generate
different reports for most sold product, high valued customers etc
which would help in growing his business.
5

Interviews to gather Information


Database Designer: “Can you tell me why you believe you need a
database?”

Customer: “I think we need a database just to keep track of all our


inventory. I’d also like to keep track of all our sales as well.”

Database Designer: “I’m sure the database will address those issues.
Now, what would you say is the single most important function of your
business?”

Customer : “To provide a wide array of bicycle products and bicycle-


related services to our customers."

Database Designer: “Can you give me an idea of the things you’d like to
track in the database?”

Customer: “sure, I want to keep track of our inventory, our customers,


and our sales.”

Database Designer: “Is there anything else that you can think of that is
related to these subjects?”

Customer “yes, if we’re going to keep track of our inventory, we should


know who our suppliers are.”

Database Designer: “What about the sales reps involved in each sale?”

Customer: “Oh yeah, we should definitely keep information about our


employees. If nothing else, it’s a good idea to do this from a human
resources point of view. At least, that’s what my wife tells me!”
6

After analyzing the current Database and the gathered information, now we can
define mission statement and mission objectives for our project.

Mission Statement
The purpose of the Cycle Shop database is to maintain the data
needed to support the business and related customer service
operations.
7

Mission Objectives
1. Maintain complete inventory information.
2. Maintain complete customer information.
3. Track all customer sales.
4. Maintain complete supplier information.
5. Maintain complete employee information.
8

After analyzing the current Database, gathered


information and mission objectives, now we can
Identify Entities, attributes and establish
relationship between different entities for our
project.
9

Identifying Entities

Entities:
1. Customers
2. Employees
3. Invoices
4. Products
5. Vendors
10

Identifying Attributes and Keys

Table Structures

Customers Employees Invoices Products Suppliers


Customer ID PK Employee ID PK Invoice ID PK Product ID PK Supplier ID

First Name First Name Customer ID FK Product Name Company Nam

Last Name Last Name Invoice Date Description Phone

Phone Phone Ship Date Price Street

Street CNIC Employee ID FK Quantity City

City Street Country

Province City

Zip_Code Province
11

Identifying Relationship

CUSTOMERS and INVOICES bear a one-to-many relationship


12

EMPLOYEES and INVOICES bear a one-to-many relationship.


13

PRODUCTS and INVOICES bear a many-to-many relationship.


14

E-R Model
15

Implementation in MySQL
CREATE TABLE Customers (
Customer_ID int NOT NULL,
First_Name VARCHAR(20),
Last_Name VARCHAR(20),
Phone VARCHAR(15),
Street VARCHAR(20),
City VARCHAR(20),
Province VARCHAR(20),
Zip_Code VARCHAR(10),
PRIMARY KEY (Customer_ID)
);
16

CREATE TABLE Employees (


Employee_ID int NOT NULL,
First_Name VARCHAR(20),
Last_Name VARCHAR(20),
Phone VARCHAR(20),
CNIC int CHECK (CNIC=13),
Street VARCHAR(20),
City VARCHAR(20),
Province VARCHAR(20),
PRIMARY KEY (Employee_ID)
);
17

CREATE TABLE Invoices (


Invoice_ID int NOT NULL,
Customer_ID int NOT NULL,
Invoice_Date DATE,
Ship_Date DATE,
Employee_ID int NOT NULL,
PRIMARY KEY (Invoice_ID),
FOREIGN KEY (Customer_ID) REFERENCES
Customers(Customer_ID),
FOREIGN KEY (Employee_ID) REFERENCES
Employees(Employee_ID)
);
18

CREATE TABLE Products (


Product_ID int NOT NULL,
Product_Name VARCHAR(20),
Description VARCHAR(50),
Price DECIMAL(10,2),
Quantity INT,
PRIMARY KEY (Product_ID)
);

CREATE TABLE Suppliers (


Supplier_ID int NOT NULL,
Company_Name VARCHAR(20),
Phone VARCHAR(20),
Street VARCHAR(20),
City VARCHAR(20),
Country VARCHAR(20),
PRIMARY KEY (Supplier_ID)
);
19

CREATE TABLE Invoice_Products (


Invoice_ID int NOT NULL,
Product_ID int NOT NULL,
Quantity_Ordered int,
Price DECIMAL(10,2),
FOREIGN KEY (Invoice_ID) REFERENCES Invoices(Invoice_ID),
FOREIGN KEY (Product_ID) REFERENCES Products(Product_ID)
);

You might also like