Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Dbms 7

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

SCHOOL OF ENGINEERING AND

TECHNOLOGY
A Database Management System Project Report
on
”E-COMMERCE MANAGEMENT SYSTEM”

Submitted in Partial fulfillment of the Requirements for the 4th Semester of


Degree of

Bachelors of Technology in Computer Science and Engineering


[Data Science]

Submitted By -

NIVAL B L [22BBTCD040]
K S V RAHUL [22BBTCD023]
CHADRASHEKAR Y[22BBTCD013]

Under the guidance of


Prof. SPANDANA S G

Department of Computer Science Engineering (Data Science)


Off Hennur – Bagalur main Road,
Near Kempegowda International Airport, Chagalahatti,
Bangalore, Karnataka – 562149
2022 - 2023
SCHOOL OF ENGINEERING AND
TECHNOLOGY
Chagalahatti, Bangalore, Karnataka – 562149

Department of Computer Science Engineering (Data Science)

CERTIFICATE
This is to certify that the Database Management System Project work entitled E-
Commerce Database Management System has been carried out by Chandrashekar
Y (22BBTCD013), K S V Rahul (22BBTCD023) and Nivas B L (22BBTCD040)
bonafide students of CMR University in partial fulfillment for the award of Bachelor of
Engineering in Computer Science and Engineering (DATA SCIENCE) during
the year 2023-2024. It is certified that all corrections/suggestions indicated for Internal
Assessment have been incorporated in the Report deposited in the departmental library.
This DBMS Project Report has been approved as it satisfies the academic requirements
in respect of project work prescribed for the said degree.

————————
Signature of Guide
Prof.Spandana.S G
Assistant Professor
HOD IT/AIML/DS

Name of the examiners Signature with date


1.

2.
Contents

1 INTRODUCTION 4
2 Pre-requisite 5
3 DESIGN/BASIC STRUCTURE 6
3.1 Functional requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Entity Relation Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Relational Database Schema . . . . . . . . . . . . . . . . . . . . . . . . . 7

4 IMPLEMENTATION 8
4.1 Creating Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

5 QUERIES 10
5.1 Basic Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.2 PL/SQL function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.3 Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

6 CONCLUSION AND FUTURE SCOPE 13


Chapter 1
INTRODUCTION

The primary objective of the E-commerce Management System is to empower


administrators of any online retail platform to efficiently manage and update product
listings, while also providing customers with a seamless experience to browse, purchase,
and track their orders. This system aims to streamline the process of maintaining com-
prehensive records of products, including their descriptions, prices, availability, and other
pertinent details, ensuring that all information is readily accessible at any moment.

The core purpose of this project is to address the requirements of an E-


commerce platform, facilitating the smooth operation and management of retail activ-
ities for businesses. Developed meticulously, this system caters to the diverse needs of
businesses engaged in online selling, providing them with a robust framework to handle
transactions and customer interactions effectively. This integrated E-commerce manage-
ment system serves as a centralized repository for all product-related data, facilitating
seamless communication between various operational aspects of the business. Featuring
a user-friendly interface, this system is designed to be intuitive and easy to navigate,
reducing the learning curve for users and enhancing their overall efficiency.
Chapter 2
Pre-requisite

Oracle SQL Server (or) Oracle Community Edition

In our DBMS project, we are developing an e-commerce system utilizing Or-


acle SQL Server or Oracle Community Edition. This system aims to provide a compre-
hensive platform for online buying and selling activities. Leveraging the robust features
of Oracle SQL Server or Oracle Community Edition, we are implementing a scalable and
efficient database schema to manage various aspects of the e-commerce ecosystem.

The database schema encompasses tables such as ’Customer’, ’Seller’, ’Product’,


’Cart’, ’Cart item’, and ’Payment’, each designed to store relevant information and
facilitate seamless transactions. For instance, the Customer table stores customer details,
including their contact information and cart associations, while the Product table holds
details about available products, such as type, color, size, and quantity.

Key functionalities, including cart management, order processing, and inven-


tory tracking, are implemented through carefully crafted SQL queries and PL/SQL pro-
cedures. Additionally, we incorporate triggers and functions to enforce data integrity and
implement business logic.

Through Oracle SQL Server or Oracle Community Edition, we ensure reliabil-


ity, performance, and scalability, meeting the demands of both users and administrators
in the dynamic e-commerce landscape.
Chapter 3
DESIGN/BASIC STRUCTURE

In this modern era of online shopping no seller wants to be left behind, moreover
due to its simplicity the shift from offline selling model to an online selling model is
witnessing a rampant growth. Therefore, as an engineer our job is to ease the path
of this transition for the seller. Amongst many things that an online site requires the
most important is a database system. Hence in this project we are planning to design a
database where small scale sellers can sell their product online.

3.1 Functional requirement


The functional requirements outline the key features and capabilities of the e-commerce
website.
• A new user can register on the website.
• A customer can see details of the product present in the cart.
• A customer can view his order history.
• Admin can start a sale with certain discount on every product.
• Customer can filter the product based on the product details.
• A customer can add or delete a product from the cart.
• A seller can unregister/ stop selling his product.
• A seller/ customer can update his details.
• Admin can view the products purchased on particular date.
• Admin can view number of products sold on a particular date.
• A customer can view the total price of product present in the cart unpurchased.
• Admin can view details of customer who have not purchased anything.
• Admin can view total profit earned from the website.
3.2 Entity Relation Diagram

Figure 3.1: Entity Relation Diagram

3.3 Relational Database Schema

Figure 3.2: Relational Database Scheme Diagram


Chapter 4
IMPLEMENTATION

The ”IMPLEMENTATION” section of our e-commerce DBMS report details the


practical execution of our database design and functionalities. It covers the development
and integration of core features such as user registration, product management, order
processing, and administrative controls. Through a systematic approach, we describe the
implementation process, including database schema creation, coding practices, testing
procedures, and deployment strategies. This section offers insights into the technical
aspects of translating conceptual designs into a fully functional e-commerce platform,
highlighting the methodologies and technologies utilized to achieve our objectives.

4.1 Creating Tables


CREATE TABLE Cart (
Cart_id VARCHAR(7) NOT NULL,
PRIMARY KEY(Cart_id)
);

CREATE TABLE Customer (


Customer_id VARCHAR(6) NOT NULL,
c_pass VARCHAR(10) NOT NULL,
Name VARCHAR(20) NOT NULL,
Address VARCHAR(20) NOT NULL,
Pincode INT NOT NULL,
Phone_number_s INT NOT NULL,
Cart_id VARCHAR(7) NOT NULL,
PRIMARY KEY (Customer_id),
FOREIGN KEY (Cart_id) REFERENCES Cart(Cart_id)
);

CREATE TABLE Seller (


Seller_id VARCHAR(6) NOT NULL,
s_pass VARCHAR(10) NOT NULL,
Name VARCHAR(20) NOT NULL,
Address VARCHAR(10) NOT NULL,
PRIMARY KEY (Seller_id)
);

CREATE TABLE Seller_Phone_num (


Phone_num INT NOT NULL,
Seller_id VARCHAR(6) NOT NULL,
PRIMARY KEY (Phone_num, Seller_id),
FOREIGN KEY (Seller_id) REFERENCES Seller(Seller_id) ON DELETE CASCADE
);

CREATE TABLE Payment (


payment_id VARCHAR(7) NOT NULL,
payment_date DATE NOT NULL,
Payment_type VARCHAR(10) NOT NULL,
Customer_id VARCHAR(6) NOT NULL,
Cart_id VARCHAR(7) NOT NULL,
total_amount NUMERIC(6),
PRIMARY KEY (payment_id),
FOREIGN KEY (Customer_id) REFERENCES Customer(Customer_id),
FOREIGN KEY (Cart_id) REFERENCES Cart(Cart_id)
);

CREATE TABLE Product (


Product_id VARCHAR(7) NOT NULL,
Type VARCHAR(7) NOT NULL,
Color VARCHAR(15) NOT NULL,
P_Size VARCHAR(2) NOT NULL,
Gender CHAR(1) NOT NULL,
Commission INT NOT NULL,
Cost INT NOT NULL,
Quantity INT NOT NULL,
Seller_id VARCHAR(6),
PRIMARY KEY (Product_id),
FOREIGN KEY (Seller_id) REFERENCES Seller(Seller_id) ON DELETE SET NULL
);

CREATE TABLE Cart_item (


Quantity_wished INT NOT NULL,
Date_Added DATE NOT NULL,
Cart_id VARCHAR(7) NOT NULL,
Product_id VARCHAR(7) NOT NULL,
purchased VARCHAR(3) DEFAULT 'NO',
PRIMARY KEY (Cart_id, Product_id),
FOREIGN KEY (Cart_id) REFERENCES Cart(Cart_id),
FOREIGN KEY (Product_id) REFERENCES Product(Product_id)
);
Chapter 5
QUERIES

5.1 Basic Queries


If the customer wants to see details of product present in the cart
select * from product where product_id in(
select product_id from Cart_item where (Cart_id in (
select Cart_id from Customer where Customer_id='cid100'
))
and purchased='YES');

If a customer wants to see order history


select product_id,Quantity_wished
from Cart_item
where (purchased='NO' and Cart_id in
(select Cart_id from customer where Customer_id='cid101'));

Customer wants to see filtered products on the basis of size,gender,type


select product_id, color, cost, seller_id
from product
where (type='jeans' and p_size='34' and gender='M' and quantity>0)

If customer wants to modify the cart


delete from cart_item
where (product_id='pid1001' and Cart_id in (select cart_id
from Customer where Customer_id='cid100'));

If a seller stops selling his product


delete from seller where seller_id = 'sid100';
update product set quantity = 00 where seller_id is NULL;

If admin want to see what are the product purchased on the particular date
select product_id
from cart_item
where (purchased='Y' and date_added='12-dec-2018');

How much product sold on the particular date


select count(product_id) count_pid,date_added
from Cart_item
where purchased='Y' group by(date_added);

If a customer want to know the total price present in the cart


select sum(quantity_wished * cost) total_payable
from product p join cart_item c on p.product_id=c.product_id
where c.product_id in
(select product_id from cart_item
where cart_id in(
select Cart_id from customer where customer_id''cid101') and purchased='Y');
Show the details of the customer who has not purchased any thing
Select * from customer
where customer_id not in
(select customer_id from Payment);

Find total profit of the website from sales.


select sum(quantity_wished * cost * commission/100) total_profit
from product p
join cart_item c on p.product_id=c.product_id
where purchased='Y';

5.2 PL/SQL function


Procedure which returns the type of product with the cost less than the given cost
create or replace procedure cost_filter(c in number,t in varchar)
is
cs product.cost%type;
ty product.type%type;
id product.product_id%type;
cursor cf is
select product_id,cost,type from product where cost<c and type=t;
begin
open cf;
loop
fetch cf into id,cs,ty;
exit when cf%notfound;
dbms_output.put_line('Product' || id || 'has cost ' || cs || ' and the type is' || ty);
end loop;
close cf;
exception
when no_data_found then
dbms_output.put_line('Sorry no such products exist');
end;

Function which returns total number of products which a particular seller sells
create or replace function totalProducts(sId in varchar)
return number
is
total number(2):=0;
begin
select count(*) into total
from product
where seller_id=sId;
return total;
end;
/

Function execution:
declare
c number(2);
begin
c:=totalProducts('sid102');
dbms_output.put_line('Total products is : '|| c);
end;

Procedure which returns the total quantity of product with the given ID
Procedure with exception handling
create or replace procedure prod_details(p_id in varchar)
is
quan number(2);
begin
select quantity into quan from product where product_id=p_id;
exception
when no_data_found then
dbms_output.put_line('Sorry no such product exist !!');
end;
/
5.3 Triggers
Trigger that will execute before inserting new customer to database and inserting a new
cartId to the cart items table
Function to count number of cart items:
create or replace function numCartId(cd in varchar)
return number
is
total number(2):=0;
begin
select count(*) into total
from cart_item
where cart_id=cd;
return total;
end;
Trigger
Create or replace trigger before_customer
before insert
on
customer
for each row
declare
c varchar(10);
n number(2);
begin
c:= :new.cart_id;
n:=numCartId(c);
if n>0 then
dbms_output.put_line('Sorry');
end if;
insert into cart values(c);
end;

Trigger to update the total amount of user everytime he adds something to payment table
create or replace function total_cost(cId in varchar)
return number
is
total number(2) :=0;
begin
select sum(cost) into total from product,cart_item where product.product_id=cart_item.product_id and cart_id=cId;
return total;
end;

create or replace trigger before_pay_up


before insert
on
payment
for each row
declare
total number(3);
begin
total :=total_cost(:new.cart_id);
insert into payment values(:new.payment_id,:new.payment_date,:new.payment_type,:new.customer_id,:new.cart_id,total);
end;
Chapter 6
CONCLUSION AND FUTURE SCOPE

The E-commerce Management System efficiently manages product listings, user


data, order processing, and administrative controls, for online retail operations. Key
achievements include a user-friendly interface, secure user management, dynamic admin-
istrative controls, and a scalable database schema.

Future Scope:

Enhancements could focus on integrating advanced technologies to further


improve functionality, security, and user experience. Potential developments include:
• AI and Machine Learning: Implement AI-driven recommendations, predictive in-
ventory management, and advanced analytics.
• Blockchain Technology: Use blockchain for secure, transparent transactions.
• Voice Search and Chatbots: Integrate voice search and AI-powered chatbots for
real-time customer support.
• Augmented Reality (AR): Allow customers to visualize products in their environ-
ment before purchasing.
• Mobile Applications: Develop native apps for iOS and Android to enhance mobile
shopping experiences.
• Sustainability Features: Promote eco-friendly practices, such as recommending sus-
tainable products and tracking carbon footprints.
These enhancements will ensure the system remains competitive, scalable, and capable
of providing exceptional value to users and administrators.

You might also like