Example 1: Consider the following database and write
SQL command as given
Customer (Cno, Cname, Caddress, Ccontact)
Product(Pid, Pname, price, quantity)
Purchase(Cno, Pid)
a) Find the names of all products having price 1000.
Answer: SELECT Pname FROM PRODUCT
WHERE price=1000;
b) Find the name of those customer who purchased
Dell Laptop.
Answer: SELECT Cname FROM Customer
NATURAL JOIN Purchase NATURAL JOIN Product
WHERE Pname = ‘Dell Laptop’;
c) Find the total number of products purchased by
customer ‘Ram’
Answer: SELECT COUNT(Pid) FROM Customer
NATURAL JOIN Purchase WHERE Cname = ‘Ram’ ;
d) Increase price of all product by 5%
Answer: UPDATE Product SET Price = price*1.05;
e) Find total price of Apple mobiles
Answer: SELECT SUM (Price) FROM Product
WHERE Pname = ‘Apple Mobile’;