Name - Amaan khan
Reg nnumber - 21BCI0351
Subject - DBMS LAB
ASSIGNMENT-4
Objective: This assignment aims to test your
understanding of aggregate functions in DBMS,
specifically focusing on MIN, MAX, SUM, and AVG
functions. Answer the following questions using SQL
queries.
Database Schema:
Consider the following database schema for an
online retail store:
Tables:
Products(ProductID, ProductName, Category, Price,
Stock)
Orders(OrderID, ProductID, Quantity, OrderDate)
Customers(CustomerID, CustomerName, City,
Country)
OrderDetails(OrderDetailID, OrderID, ProductID,
Quantity, Price)
Reviews(ReviewID, ProductID, CustomerID, Rating,
ReviewDate)
Questions:
1.What is the minimum, maximum, and average
price of products in the 'Electronics' category?
Solution
SQL Queries:
1. Minimum Price:
Maximum Price:
Average Price:
2.Calculate the total sales amount for all orders.
Solutions
3.Which customer has placed the highest number of
orders?
4.What is the average rating for each product based
on customer reviews?
Solution
5.What are the minimum and maximum quantities
ordered for each product?
Solution
6.What is the total stock value for each category of
products?
Solution
7.Which product has the highest total sales quantity?
Solution
8.What is the average number of orders placed per
customer?
Solution
9.Which product has the highest average rating
based on customer reviews?
Solution
10.How many different products has each customer
reviewed?
Solution