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

Create Database Online - Shopping

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

Create Database Online - Shopping

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

create database Online_shopping_Database;

Create table Products1


(
Product_id int primary key,
product_name Varchar(40),
Description Varchar(40),
price money,
stock_quantity int,
Category_id int Foreign key references categories(Category_id),
);
Create table Categories
(
Category_id int primary key,
Category_name Varchar(40),
);
Select * From Products1
Select * From Categories
Create table Customers1
(
Cid int primary key,
Cname Varchar(40),
Cage int,
CMobile int,
CEmail Varchar(40),
Caddress Varchar(30),
);
Select * From Customers1
Create table Orders
(
Order_id int primary key,
customer_id int Foreign Key References Customers1(Cid),
Order_date date,
total_amount int,
);
Create table Transactions
(
Transaction_id int Primary Key,
Order_id int Foreign Key References Orders(Order_id),
Payment_date date,
payment_method varchar(30),
Amount int,
);
Select * From Transactions
Select * From Orders
Create table OrderItemsTable
(
Order_id int Foreign Key References Orders(Order_id),
Product_id int Foreign Key References Products1(Product_id),
Quantity int,
Price money,
);
Select * From OrderItemsTable;
Create Table Reviews
(
review_id int Primary Key,
Custeomer_id int Foreign Key References Customers1(Cid),
Product_id int Foreign Key References Products1(Product_id),
rating int check(rating = 0 or rating = 1 or rating = 2 or rating = 3 or rating = 4
or rating = 5),
Comment Varchar(20),
Review_date date,
);
Select * From Reviews;
Create Table Addressess
(
Customer_id int Foreign Key References Customers1(Cid),
C_Address Varchar(50),
City Varchar(40)
);
Select * From Addressess;
Create Table Wishlist
(
Wishlist_id int Primary Key,
Customer_id int Foreign Key References Customers1(Cid),
Product_id int Foreign Key References Products1(Product_id),
Wishlist_Date date,
);
Create Table Cart
(
cart_item_id int Primary Key,
Customer_id int Foreign Key References Customers1(Cid),
Product_id int Foreign Key References Products1(Product_id),
Cart_date date,
quantity int,
);
Select * From Cart;
Create Table Promotions
(
Promotion_id int Primary Key,
Promotion_Name Varchar(50),
Promotion_Start_date date,
Promotion_End_date date,
discount_percentage int,
);
Select * From Promotions;

You might also like