SELECT COUNT(*) AS TotalOrders FROM Orders;
Counts every row in the Orders table to give you the total number of orders placed.
SELECT SUM(quantity * price) AS TotalRevenue FROM Orders;
Calculates the gross revenue by multiplying the quantity of items by their price for every row and adding
them all together.
SELECT avg(quantity * price) AS AverageOrderValue FROM Orders;
Finds the mean (average) value of all orders in the table.
SELECT product, price FROM Orders WHERE price = (SELECT MAX(price) FROM Orders);
Identifies the most expensive items. It first finds the highest price in the table, then pulls the names of
products that match that specific price.
SELECT product, price FROM Orders WHERE price = (SELECT MIN(price) FROM Orders);
It identifies the cheapest items in the table.
SELECT category, SUM(quantity) AS TotalQuantitySold FROM Orders GROUP BY category;
Organizes the data by category and shows the total volume of items sold for each specific group.
SELECT city, SUM(quantity * price) AS total_revenue FROM Orders GROUP BY city HAVING
total_revenue > 100000;
Calculates revenue per city but filters the results to only show cities that have generated more than
100,000 in total sales.
SELECT category, avg(price) AS average_price FROM Orders GROUP BY category HAVING average_price
> 50000;
Groups items by category and calculates the average price of items within those categories, but only
displays groups where the average price exceeds 50,000.