0% found this document useful (0 votes)
8 views6 pages

Pizza Sales SQL Queries Overview

The document outlines SQL queries for analyzing pizza sales, including key performance indicators such as total revenue, average order value, and total pizzas sold. It also includes queries for daily and monthly order trends, percentage of sales by pizza category and size, and rankings for top and bottom pizzas by revenue and quantity. These queries are designed to provide insights into sales performance and customer preferences.

Uploaded by

jhgnbh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Pizza Sales SQL Queries Overview

The document outlines SQL queries for analyzing pizza sales, including key performance indicators such as total revenue, average order value, and total pizzas sold. It also includes queries for daily and monthly order trends, percentage of sales by pizza category and size, and rankings for top and bottom pizzas by revenue and quantity. These queries are designed to provide insights into sales performance and customer preferences.

Uploaded by

jhgnbh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PIZZA SALES SQL QUERIS

A. KPI’s
1. Total Revenue:
SELECT
SUM (total_price) AS Total_Revenue
FROM Pizza_Sales

2. Average Order Value:


SELECT
SUM (total_price) / COUNT(DISTINCT order_id) AS Avg_Order_Value
FROM pizza_sales

3. Total Pizza Sold:


SELECT
SUM (quan ty) AS Total_Pizza_Sold
FROM pizza_sales

4. Total Orders:
SELECT
SUM (DISTINCT order_id) AS Total_Orders
FROM Pizza_Sales

5. Average Pizzas Per Order:


SELECT
CAST (
CAST (SUM (quan ty) AS DECIMAL (10,2)) /
CAST (COUNT (DISTINCT order_id) AS DECIMAL (10,2))
AS DECIMAL (10,2)) AS Avg_Pizza_Per_Order
FROM Pizza_Sales

B. Daily Trend for orders:


SELECT
DATENAME (DW, order_date) AS Order_Day,
COUNT (DISTINCT order_id) AS Total_Orders
FROM Pizza_Sales
GROUP BY DATENAME (DW, order_date)
C. Monthly Trends for Total Orders:
SELECT
DATENAME (MONTH, order_date) AS Month_Name,
COUNT (DISTINCT order_id) AS Total_Orders
FROM Pizza_Sales
GROUP BY DATENAME (MONTH, order_date)

D. % of Sales by Pizza category:


SELECT
pizza_category,
SUM (total_price) AS Total_Sales,
SUM (total_price) * 100 /
(SELECT SUM (total_price) FROM Pizza_Sales) AS PCT
FROM Pizza_Sales
GROUP BY pizza_category

D. % of Sales by Pizza Size:


SELECT
pizza_size,
CAST (SUM (total_price) AS DECIMAL (10,2)) AS Total_Sales,
CAST (SUM (total_price) * 100 /
(SELECT SUM (total_price) FROM Pizza_Sales) AS decimal (10,2)) AS PCT
FROM Pizza_Sales
GROUP BY pizza_size
ORDER BY PCT DESC

F. Total Pizzas Sold by Pizza Category:


SELECT pizza_category, SUM (quantity) as Total_Quantity_Sold
FROM Pizza_Sales
WHERE MONTH (order_date) = 2
GROUP BY pizza_category
ORDER BY Total_Quantity_Sold DESC

G. Top 5 Pizzas by Revenue:


SELECT
TOP 5 pizza_name,
SUM (total_price) AS Total_Revenue
FROM Pizza_Sales
GROUP BY pizza_name
ORDER BY Total_Revenue DESC
H. Bo om 5 Pizzas by Revenue:
SELECT
TOP 5 pizza_name,
SUM (total_price) AS Total_Revenue
FROM Pizza_Sales
GROUP BY pizza_name
ORDER BY Total_Revenue ASC

I. Top 5 Pizzas by Quan ty:


SELECT
TOP 5 pizza_name,
SUM (quantity) AS Total_Quantity
FROM Pizza_Sales
GROUP BY pizza_name
ORDER BY Total_Quantity DESC

L. Bo om 5 Pizzas by Total Orders:


SELECT
TOP 5 pizza_name,
SUM (quantity) AS Total_Quantity
FROM Pizza_Sales
GROUP BY pizza_name
ORDER BY Total_Quantity ASC

You might also like