You are on page 1of 1

Practical Assignment-11

Date.21.07.23

Ques. In the table of assignment do following:

1.Add a new column quantity.

2.Find the total valueof the table product.

3.Find the average quantity.

4.Find the category wise value of each category.

5.Find the maximum and minimum quantity of the table.

Code:

ALTER TABLE product

ADD COLUMN quantity INT;

SELECT SUM(price * quantity) AS total_value

FROM product;

SELECT AVG(quantity) AS average_quantity

FROM product;

SELECT category, SUM(price * quantity) AS category_value

FROM product

GROUP BY category;

SELECT MAX(quantity) AS max_quantity, MIN(quantity) AS min_quantity

FROM product;

You might also like