Class 12: SQL Questions 5

Question:

TABLE:PRODUCT

P_ID

PRODUCTNAME

MANUFACTURER

PRICE

TP01

TALCOM POWDER

LAK

40

FW05

FACE WASH

ABC

45

BS01

BATH SOAP

ABC

55

SH06

SHAMPOO

XYZ

120

FW12

FACE WASH

XYZ

95

TABLE:CLIENT

C_ID

CLIENTNAME

CITY

P_ID

01

COSMETIC SHOP

DELHI

FW05

06

TOTAL HEALTH

MUMBAI

BS01

12

LIVE LIFE

DELHI

SH06

15

PRETTY WOMAN

DELHI

FW12

16

DREAMS

BANGLORE

TP01

 

Queries

Q.1.
To display the details of those clients whose city is “delhi”

Ans:

Select * from client where city=’Delhi’;

Q.2.
To display the details of products price is in the range of 50 to 100

Ans:
Select * from product where price between 50 and 100;

Q.3.
TO DISPLAY THE client name ,city from table client andd productname and price from the table product with their corresponding matching p_id

Ans:

Select clientname, city, productname, price from client, product where client.prod_it=product.prod_id;

Q.4.
To increase the price of the product by 10.

Ans:
Update product set price=price+10;

Q.5.
Select distinct city from client;

Ans:

Delhi
Mumbai
Banglore

Q.6.
Select manufacturer,max(price),count(*) from product group by manufacturer;

Ans:

Lak 40 40 1
Abc 55 45 2
Xyz 120 95 2

Q.7.
Select clientname, manufacturername
from product, client
where client.prod_id=product.prod_id;

Ans:

Cosmetic shop face wash
Total health bath soap
Live life shampoo
Pretty woman face wash
Dreams talcum powder

Q.8.
Select productname,price*4 from product;

Ans:

Talcum powder 160
Face wash 180
Bath soap 220
Shampoo 480
Face wash 380