DBMS Report
DBMS Report
Submitted By
Karthik Prabhu SR (22BBTCS135)
Khushali Varu (22BBTCS143)
1
SCHOOL OF ENGINEERING AND TECHNOLOGY
Chagalahatti, Bengaluru, Karnataka-562149
Department of Computer Science and Engineering
CERTIFICATE
Certified that the Project Work entitled “ Online E – commerce Website ”
carried out by Karthik Prabhu SR (22BBTCS135) and Khushali Varu (22BBTCS143)
bonafide students of SCHOOL OF ENGINEERING AND TECHNOLOGY, in
partial fulfillment for the award of BACHELOR OF TECHNOLOGY in Computer
Science and Engineering of CMR UNIVERSITY, Bengaluru for 4CSGC2021 – Database
Management System during the academic year 2023 - 2024. It is certified that all
corrections/suggestions indicated for the Internal Assessment have been incorporated in the
report. The project has been approved as it satisfies the academic requirements in respect of
project work prescribed for the said degree.
…………………… ……………………
Dept. of CSE Dept. of CSE
SoET, CMRU, Bangalore SoET, CMRU, Bangalore
1…………………… …...…………………..
2.…………………... ………………………..
2
DECLARATION
We, Karthik Prabhu SR bearing USN 22BBTCS135 and Khushali Varu bearing USN
22BBTCS143 students of Bachelor of Technology, Computer Science and Engineering,
CMR University, Bengaluru, hereby declare that the Project Work entitled “ Online E-
commerce Website” submitted by us, for the award of the Bachelor’s degree in Computer
Science and Engineering to CMR University is a record of bonafide work carried out
independently by us under the supervision and guidance of Dr.Gourish Goudar Professor,
Dept of CSE. CMR University. We further declare that the work reported in this mini
project work has not been submitted and will not be submitted, either in part or in full, for
the award of any other degree in this university or any other institute or University.
3
TABLE OF CONTENTS
2. Entity – 6-8
Relationship Model
3. Conversion of er – 9 - 14
diagram to
relational tables
4. Normalization 10 - 15
5. Implementation of 16 - 22
DBMS database in
SQL
4
PROBLEM STATEMENT
5
ENTITY RELATIONSHIP MODEL
6
COMPONENTS OF ENTITY RELATIONSHIP MODEL
7
➢ Entity : Cart
Attributes : Cart_id , quantity
Primary key : Cart_id
➢ Entity : Shipment
Attributes : Shipment_id , date , address
Primary key : Shipment_id
Composite attribute : Address (pincode , street , city , state)
➢ Entity : Order
Attributes : Order_id , order_date , total_price
Primary key : Order_id
➢ Entity : Order_item
Attributes : Order_item_id , quantity , price , order_id ,
product_id
Primary key : Order_id
Foreign key : Order_id , Product_id
➢ Entity : Product
Attributes : Category_id , product_id , Product_name ,
description , price , stock
Primary key : Product_id
Foreign key : Category_id
➢ Entity : Cart
Attributes : Cart_id , quantity
Primary key : Cart_id
➢ Entity : Payment
Attributes : Payment_id , Payment_date , Payment_method ,
Amount , Order_id
Primary key : Payment_id
8
CONVERSION OF ER DIAGRAM TO
RELATIONAL TABLES
1) Customer (
Customer_id (primary key) , Customer_name , password , address ,
paymentcard_info , email , phone_no)
2) Cart (
Cart_id (primary key) , quantity)
3) Shipment (
Shipment_id (primary key) , date , address)
4) Category (
Category_id (primary key) , name)
5) OrderTable (
Order_id (primary key) , Order_date , Total_price)
6) Product (
Product_id (primary key) , description , price , stock , Category_id ,
(foreign key))
7) Order_item (
Order_item_id (Primary key) , Quantity , Price , Order_id(foreign
key) , Product_id (foreign key))
8) Payment (
Payment_id (primary key) , Payment_date , payment_method ,
amount , order_id(foreign key))
9
NORMALIZATION
I NF (First Normal Form) : It ensures that each attribute in the relation contains atomic values
i.e. no repeating values.
II NF (Second Normal Form) : The relation must be in 1NF and should not contain any partial
dependencies.
III NF (Third Normal Form) : The relation must be in 2NF and should not contain any transitive
dependencies.
BCNF (Boyce – codd Normal Form) : The table must be in 3NF and every determinant should
be a super key.
IV and V NF : These normal forms deal with multivalued dependencies and join dependencies
respectively.
CUSTOMER TABLE
Functional dependencies :
• Customer_id → Customer_name, Password, Address, Paymentcard_info, Email,
Phone_no
• Address → City, State, Pincode (derived)
• Paymentcard_info → Card_type, Card_number (derived)
1 NF - The table is already in 1NF where each cell contains a single values and there
are no repeating values.
2 NF – Here , we are creating the following separate tables –
CUSTOMER TABLE
ADDRESS TABLE
3 NF – Here , we are removing the transitive dependencies and we obtain the following
table :
CITIES TABLE
10
STATES TABLE
PINCODES TABLE
PRODUCT TABLE
Functional dependencies :
• Product_id → Description, Price, Stock, Category_id
• Category_id → Category_name (assumed)
• Description → Product_id, Price, Stock, Category_id
• Price, Stock → Product_id
1 NF – The table is already in 1NF where each cell contains a single values and there
are no repeating values.
2 NF – Here , we will separate the data into two tables :
PRODUCT TABLE
STOCK TABLE
11
3 NF – Here , we are removing transitive dependencies and we are creating a table
Categories
CATEGORY TABLE
Functional dependencies :
• Category_id → Name
1 NF - The table is already in 1NF where each cell contains a single values and
there are no repeating values.
2 NF – The table is in 2 NF as there is only one non – prime attribute and one
candidate key.
3 NF – Here , we will remove transitive dependencies and obtain the following
table :
ORDER TABLE
Functional dependencies :
• Order_id → Order_date, Total_price
• Order_date → Year, Month, Day (derived)
1 NF - The table is already in 1NF where each cell contains a single values and
there are no repeating values.
2 NF – Following is the table in 2 NF :
12
3 NF – There is no transitive dependencies. Hence , the table remains in 3 NF.
1 NF - The table is already in 1NF where each cell contains a single values and there
are no repeating values.
2 NF – Following tables are separated in 2 NF :
ORDER_ITEM TABLE
ORDERS TABLE
PRODUCT TABLE
13
3 NF - There is no transitive dependencies. Hence , the table remains in 3 NF.
CART TABLE
The cart table is in it’s simplest form containing two columns with no dependencies. Hence ,
the given table is in 1 NF , 2 NF and 3 NF.
PAYMENT TABLE
Functional dependencies :
• Payment_id → Payment_date, Payment_method, Amount, Order_id
1 NF - The table is already in 1NF where each cell contains a single values and there are no
repeating values.
2 NF – The separate table created are as follows :
SHIPMENT TABLE
Functional dependencies :
14
• Shipment_id → Date, Address
• Address → Street_address, City, State, Pincode
1 NF - The table is already in 1NF where each cell contains a single values and there are no
repeating values.
2 NF – We obtain the following tables in 2 NF
STATES TABLE
PINCODES TABLE
15
IMPLEMENTATION OF DATABASE IN SQL
Creation of database e_commerce ->
16
Creation of table Shipment ->
17
Creation of table Payment ->
18
Inserting values into Category table ->
19
Inserting values into Product table ->
20
Inserting values into Order_item table ->
21
Inserting values into Payment table ->
22