Systems Analysis Design and Case Assignment

You might also like

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

SYSTEMS ANALYSIS

DESIGN AND CASE


ASSIGNMENT
(SQL ASSIGNMENT)

Submitted to-
Dr. P. SRIDEVI
(Course Instructor)
Submitted By-
Chandril Garg
215120029
MBA 1st Year
DoMS NITT

DOMS_NITT
Question 1
1. Creating table structure
CREATE TABLE customer (customer_id varchar(15) not null primary key,
name varchar(30),
city varchar(30),
state varchar(30),
postal_code int,
region char(10));

2. CREATE TABLE product (product_code varchar(20) not null primary key,


category varchar(30),
sub_category varchar(30),
product_name varchar(50));

3. CREATE TABLE sales (order_id varchar(15) not null,


ship_mode varchar(30),
customer_id varchar(30),
product_id varchar(30),
sales_amt float,
FOREIGN KEY (product_id) REFERENCES product (product_code),
FOREIGN KEY (customer_id) REFERENCES customer (customer_id)
);

DOMS_NITT
Question 2

1. Insertion
insert into product
values ('TEC-PH-215120029','Technology','Phones','Iphone 12')
2. Show inserted value
select * from product where category = 'Technology'

DOMS_NITT
Question 3
DELETE FROM sales where customer_id = 'AB-10600'
select * from sales

DELETE FROM customer where customer_id = 'AB-10600'


select * from customer

DOMS_NITT
Question 4
select distinct ship_mode from sales

Question 5
select * from sales s join customer c on s.customer_id=c.customer_id join product p on
s.product_id=p.product_code where c.customer_id='SO-20335'

DOMS_NITT
Question 6
select category, sum(sales_amt) from product p join sales s on s.product_id=p.product_code
group by category ;

Question 7
SELECT name, customer_id FROM customer where customer_id NOT IN (SELECT
customer_id FROM sales);

DOMS_NITT
Question 8
update customer set city='Moradabad', state = 'Uttar Pradesh', postal_code='244001', region=
'North' where customer_id='AG-10270';
select * from customer where customer_id='AG-10270'

DOMS_NITT

You might also like