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

Pizza Sales SQL Queries

The document outlines SQL queries for analyzing pizza sales, including key performance indicators (KPIs) such as total revenue, average order value, total pizzas sold, total orders, and average pizzas per order. It also specifies chart requirements for visualizing daily and hourly trends, sales percentages by pizza category and size, total pizzas sold by category, and identifying the top and bottom five best-selling pizzas. These queries facilitate comprehensive insights into sales performance and customer preferences.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Pizza Sales SQL Queries

The document outlines SQL queries for analyzing pizza sales, including key performance indicators (KPIs) such as total revenue, average order value, total pizzas sold, total orders, and average pizzas per order. It also specifies chart requirements for visualizing daily and hourly trends, sales percentages by pizza category and size, total pizzas sold by category, and identifying the top and bottom five best-selling pizzas. These queries facilitate comprehensive insights into sales performance and customer preferences.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PIZZA SALES SQL QUERIES

1.KPI’S
(a) Total Revenue
select SUM(total_price) as Total_Revenue from pizza_sales;

(b) Average Order Value


select SUM(total_price) / COUNT(DISTINCT order_id) as Average_Order_Value from pizza_sales

(c) Total Pizzas Sold


select SUM(quantity) as Total_Pizzas_Sold from pizza_sales

(d) Total Orders


select COUNT(DISTINCT order_id) as Total_orders from pizza_sales

(e) Average Pizzas per Order


select CAST(CAST(SUM(quantity) as decimal(10,2)) /
CAST(COUNT(DISTINCT order_id) as decimal(10,2)) as decimal(10,2)) as
Average_Pizzas_per_order from pizza_sales
2. Charts Requirments
(a) Daily Trend
select DATENAME(DW, order_date) as order_day, COUNT(DISTINCT order_id) AS Total_orders
from pizza_sales
GROUP BY DATENAME(DW, order_date)

(b) Hourly Trend


SELECT DATEPART(HOUR, order_time) AS order_hours, COUNT(DISTINCT order_id) AS
Total_orders
FROM pizza_sales
GROUP BY DATEPART(HOUR, order_time)
ORDER BY DATEPART(HOUR, order_time)
(c) % sales by pizza category
SELECT pizza_category, SUM(total_price) AS Total_Sales,CAST(SUM(total_price) * 100/ (SELECT
SUM(total_price) FROM pizza_sales) AS DECIMAL(10,2)) AS Total_PCT_Sales
from pizza_sales GROUP BY pizza_category

(d) % sales by pizza size


SELECT pizza_size, SUM(total_price) AS Total_Sales, CAST(SUM(total_price) * 100/ (SELECT
SUM(total_price) FROM pizza_sales) AS DECIMAL(10,2)) AS Total_PCT_Sales
from pizza_sales
GROUP BY pizza_size
ORDER BY Total_PCT_Sales DESC
(e) Total pizza sold by pizza category
SELECT pizza_category, SUM(quantity) AS Total_Pizzas_Sold
from pizza_sales
GROUP BY pizza_category

(f) Top 5 best sellers by total pizzas sold


SELECT TOP 5 pizza_name, SUM(quantity) AS Total_Pizzas_Sold
from pizza_sales
GROUP BY pizza_name
ORDER BY sum(quantity) DESC

(g) Bottom 5 worst sellers by total pizzas sold


SELECT TOP 5 pizza_name, SUM(quantity) AS Total_Pizzas_Sold
from pizza_sales
GROUP BY pizza_name
ORDER BY sum(quantity)

You might also like