1.

Carefully observe the following table named ‘stock’: Table: stockWrite SQL queries for the following: (a) To display the records in decreasing order of price. (b) To display category and category wise total quantities of products. (c) To display the category and its average price. (d) To display category and category wise highest price of the products.

Answer»

(a) select * from stock order by price desc; 

(b) select category, sum(qty) from stock group by category; 

(c) select category,avg(price) from stock group by category; 

(d) select category, max(price) from stock group by category;



Discussion

No Comment Found

Related InterviewSolutions