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

Fast Service Boy: Customer - I D Customer - Na Me Item - Name Quantit y Price

The document contains two tables - CUSTOMER and FAST SERVICE BOY (referred to as DELIVERY in the questions). The CUSTOMER table contains customer details like customer id, name, item purchased, quantity, and price. The DELIVERY table contains customer id, delivery man, and charges. 15 SQL questions are asked related to these two tables - to display, insert, update, count, calculate average/sum, join tables, create/drop view, order, filter rows.

Uploaded by

Sahil Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Fast Service Boy: Customer - I D Customer - Na Me Item - Name Quantit y Price

The document contains two tables - CUSTOMER and FAST SERVICE BOY (referred to as DELIVERY in the questions). The CUSTOMER table contains customer details like customer id, name, item purchased, quantity, and price. The DELIVERY table contains customer id, delivery man, and charges. 15 SQL questions are asked related to these two tables - to display, insert, update, count, calculate average/sum, join tables, create/drop view, order, filter rows.

Uploaded by

Sahil Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SQL

Customer_i
d

Customer_na
me

Item_name

Quantit
y

Price

A23001

Tarun Sethi

soap

10 pcs

1500

A45005

Sahil gupta

detergent

5 kg

4000

B56777

Chandan Jena

rice

15 kg

350

F57478

Ritvik Menon

oil

10 l

1800

C65474

Swaroop sahoo

dal

2 kg

500

A40007

S. Behera

sugar

3 kg

250

S34009

S. Mishra

salt

10 kg

600

FAST SERVICE BOY


Customer_i
d

Delivery_
man

Charge
s

A23001

Bhaskar

50

A45005

Rahul

65

B56777

Vinod

110

F57478

Ranjan

85

C65474

Venket

64

A40007

Manoj

25

S34009

Jeevan

80

SQL Questions
1) Write a SQL command to display all the contents of the table
CUSTOMER.
Ans. SQL> SELECT * FROM CUSTOMER ;

2) Write a Query to Display minimum price from the table CUSTO


Ans. SQL> SELECT MIN(Price) FROM CUSTOMER;

3) Write a SQL command to Insert a new row into the Table CUSTO
Ans. SQL> INSERT INTO CUSTOMER
VALUES(B6504,Manoj Sahoo,Pakoda,5,120);

4) Write a Query that displays the average of price from the table
CUSTOMER.
Ans. SQL> SELECT AVG(Price) FROM CUSTOMER;

5) Write a Query to count the Number Of Customers From the Tab


CUSTOMER.
Ans. SQL> SELECT count(Cust_Name) FROM CUSTOMER.

6) Write a Query to Display the Item name, Customer ID, Custome


Name
& their respective delivery boy name from the tables CUSTOMER
COURIER.
Ans. SQL> Customer_id,Customer_name,Item_name,Delivery_boy
FROM CUSTOMER A , DELIVERY B
WHERE ( A.Customer_id=B.Customer_id);
7) Write a Query to display total quantity of items from the table
CUSTOMER.
Ans. SQL> SELECT SUM(Quantity) FROM CUSTOMER;

8) Write a Query to decrease the price by Rs.1000 only where the


is greater
than 2000.
Ans. SQL> UPDATE CUSTOMER
SET PRICE = PRICE 1000
WHERE(PRICE>2000);

ORDER BY Cust_Name DESC;


10) Write a Query to Display the Customer name & their
respective Delivery from the tables
CUSTOMER & DELIVERY.
Ans. SQL> Customer_name,Delivery_boy
FROM CUSTOMER A ,DELIVERY B
WHERE (A.Customer_id=B.Customer_id);
11) Write a Query to create view table TEMP for the table
CUSTOMER.
Ans. SQL> CREATE VIEW TEMP
AS SELECT * FROM CUSTOMER;

12) Write a Query to Delete the row where name is


S.Mishra From the table CUSTOMER.
Ans. SQL> DELETE FROM CUSTOMER
WHERE Cust_name=S.Mishra;
13) Write a Query to display the Cust_name whose
name starts with letter S.
Ans. SQL> SELECT * FROM CUSTOMER
WHERE Customer_name LIKE S %;
14)Write a SQL command to delete all the tuples from
table DELIVERY only where Delivery Charges is less than
60.
Ans. DELETE FROM COURIER
WHERE(Delivery_Charges<60)
15) Write a SQL command to drop the View table TEMP.
Ans. DROP VIEW TEMP;

You might also like