Course Code: CSE - 210 Experiment No: Job No - 05 Experiment Title: Implementation of MySQL Aggregate Function.
Submitted by: Submitted to:
Name: Ujjal Kumar Roy BABE SULTANA ID: 191002326 Lecturer Section: DC Department of CSE Green University of Bangladesh Department of CSE Green University of Bangladesh
Problem 3: Write a query to list the number of product_type available in the product table. Solution: SELECT product_type, COUNT(product_type) as product_type_available FROM products GROUP by product_type;
Problem 4: Write a query to get the number of products with the same product type. Solution: SELECT product_type, COUNT(Quantity) as same_pro duct_type FROM products GROUP by product_type ORDER BY same_product_type DESC;
Problem 5: Write a query to get the difference between the highest and lowest price of a stationary product. Solution: SELECT product_type, (MAX(price)-MIN(price)) as difference_between_the_highest_and_lowest_pri ce FROM products WHERE product_type='Stationary';