Q. Write SQL queries to perform the following based on the table PRODUCT having fields as
(prod_id, prod_name, quantity, unit_rate, price, city)
(i) Display those records from table PRODUCT where prod_id is more than 100.
(ii) List records from table PRODUCT where prod_name is 'Almirah'.
(iii) List all those records whose price is between 200 and 500.
(iv) Display the product names whose price is less than the average of price.
(v) Show the total number of records in the table PRODUCT.
Answer =
(i)
Select * from PRODUCT where prod_id > 100 ;
(ii)
Select * from PRODUCT where prod_name = “Almirah” ;
(iii)
Select * from PRODUCT where price between 200 and 500 ;
(iv)
Select prod_name from PRODUCT having price < avg(price) ;
(v)
Select count(prod_name) from PRODUCT;
in fifth part it will be count(prod_name) minor spelling mistake ....
ReplyDeleteSorry.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )