05 - Ritesh Dbms Assignment 3

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

DBMS ASSIGNMENT 3

Name: Ritesh Verma


Roll Number: 31401219005
Stream :BCA
Year: 2nd
Semester: 4th
Subject : DBMS Practical (BCAN 491)
College: Techno India College of Technology
Submitted to: Aloke Bera Sir.

TABLE CREATION:
Create Table named “SALES”.
Code for table creation:
create table sales1(orderid number(2), orderdate date, orderprice
number(5), orderquantity number(2), customername varchar2(15));
Code for displaying Variable:
desc sales1;

Code for Inserting values to the table:


insert into sales1 values(1,'22-DEC-2005',160,2,'smith');
insert into sales1 values(2,'08-OCT-2005',190,2,'johnson');
insert into sales1 values(3,'13-JULY-2005',500,5,'baldwin');
insert into sales1 values(4,'15-JULY-2005',420,2,'smith');
insert into sales1 values(5,'22-DEC-2005',1000,4,'wood');
insert into sales1 values(6,'10-FEB-2005',820,4,'smith');
insert into sales1 values(7,'11-MAR-2005',2000,2,'baldwin');

Code for displaying table Sales:


select * from sales1;
QUERIES:
1. Count how many orders have made a customer with
Customer name Smith.
(Ans) select sum(orderquantity)"Total orders of Smith"
from(select *from sales1 where customername='smith');

2. Find number of unique customers that have ordered


from the store.
(Ans) select count(customername)"Number of Unique
Customer" from (select distinct customername from
sales1);
3. Find out total numbers of Items ordered by all the
customers.
(Ans) select sum(orderquantity)"Total Number of orders
items" from sales1;

4. Find out the average number of items per order.


(Ans) select avg(orderquantity) from sales1;
5. Find out the ways the minimum price paid for any of
the orders.
(Ans) select min(orderprice) from sales1;

6. Find out the highest order price from the given sales
table.
(Ans) select max(orderprice) from sales1;
7. List out unique Customer’s name only from the table.
(Ans) select distinct customername from sales1 order by
customername;

8. List out name of the customers who have given order in


the month of DECEMBER.
(Ans) select orderprice, orderquantity,
orderprice*orderquantity, customername from sales1;

You might also like