Challenge

Project 1

Task 2:-

create database project1;
use project1;

create table orderd(
ord_id int,
ord_name varchar(50),
ord_address varchar(50),
city varchar(50),
state varchar(50),
contact int,
customer_id int,
primary key(ord_id),
foreign key(customer_id) references customer(customer_id)
);

create table customer(
customer_id int ,
gender varchar(50),
dob date,
city varchar(50),
pw int,
customer_name varchar(50),
email varchar(50),
del_address varchar(50),
contacts int,
primary key(customer_id)
);

create table Sellers(
sell_id int,
sell_name varchar(50),
sell_mobile int,
password varchar(50),
cat_id int,
foreign key (cat_id) references category(cat_id),
primary key(sell_id));

create table category(
cat_id int,
cat_name varchar(50),
cat_description varchar(50),
primary key(cat_id));

create table product(
product_id int,
cat_id int,
product_name varchar(50),
product_desc varchar(50),
price varchar(50),
color varchar(50),
brand varchar(50),
calculations int,
isFeatured varchar(50),
polularityIndex int,
totalratings varchar(50),
reviews varchar(50),
primary key(product_id),
foreign key (cat_id) references category(cat_id));

create table cart(
ord_id int,
custom varchar(50),
size int,
quality int,
product_id int,
foreign key(ord_id) references orderd(ord_id),
foreign key(product_id) references product(product_id));

create table login(
login_id int ,
username varchar(50),
email varchar(50),
role varchar(50),
views varchar(50),
primary key(login_id));

Task 3:- Solution

(1)Solution:-

select * from customer order by city;

(2)Solution:-

alter table product rename column product_id to prod_id;

(3)Solution:-

select * from customer where prod_id>1;

(4)Solution:-

select * from customer where customer_name like 'R%' and '%R' and purchased >1;

(5)Solution:-

select * from orderd a where purch_amt>10000 and purchased>1 order by ord_deliverded;

(6)Solution:-

select * from table_name;
insert into table_name values(101, "raja babu");
alter table product rename column product_id to prod_id;

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.