[go: up one dir, main page]

0% found this document useful (0 votes)
60 views3 pages

Online Retail System: (Sahil, 1917634)

The document describes the creation of tables for an online retail system database. It includes tables for customers, products, shopping carts, cart items, payments and user accounts. Foreign key relationships are defined between the tables. Sample data is inserted into each table, and select statements are provided to query the tables.

Uploaded by

samridh sood
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)
60 views3 pages

Online Retail System: (Sahil, 1917634)

The document describes the creation of tables for an online retail system database. It includes tables for customers, products, shopping carts, cart items, payments and user accounts. Foreign key relationships are defined between the tables. Sample data is inserted into each table, and select statements are provided to query the tables.

Uploaded by

samridh sood
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/ 3

Online Retail System

(Sahil ,1917634)
Create database db_Online_Retail_System;
use db_Online_Retail_System;

---create table customer


create table tbl_customer(
first_name varchar(40),
last_name varchar(40),
home_address varchar(50),
contact_no int,
email_address varchar(50),
customer_id int primary key,
customer_password varchar(40)

);

--create product table


create table tbl_products(
product_name varchar(30),
product_id int primary key,
price int,
product_description varchar(400)
);
---create table cart item
create table tbl_cart_item(
cart_item_id int primary key,
quantity int,
total_cost int

);

---create table cart


create table tbl_cart(
cart_id int,
total_cost int
);
---create table payment
create table payment(
amount int,
payment_id varchar(40) primary key,
payment_type varchar(40)
);

--create table account

create table tbl_account(


ac_no varchar(20) primary key,
account_type varchar(30),
balance int
);
alter table tbl_cart_item add product_id int foreign key references
tbl_products(product_id);
alter table payment add customer_id int foreign key references
tbl_customer(customer_id);
alter table payment add unique(amount) ;
alter table tbl_account add payment int foreign key references payment(amount);

-----select statements
select * from tbl_account;
select * from tbl_cart;
select * from tbl_cart_item;
select * from tbl_customer;
select * from tbl_products;
select * from payment;

--insert into tables


insert into tbl_account values(12122,'saving Account',232320);
insert into tbl_cart values(5,33250);
insert into tbl_cart_item values(4,1,40);
insert into tbl_customer values('Raju','Hansraj','332
Sector',466546561,'32@yahoo.com',33,'rahanahgabhala');
insert into tbl_products values('Shampoo',121,3132,'Exclusive product');
insert into payment values(3132,'2ap','credit card');

You might also like