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

Pizza Sales SQL Queries (AutoRecovered)

The document outlines SQL queries for analyzing pizza sales, including key performance indicators (KPIs) such as total revenue, average order value, and total pizzas sold. It also includes queries for generating charts to visualize daily and hourly trends, sales percentages by category and size, and identifying the top and bottom five best-selling pizzas. These queries provide insights into sales performance and customer preferences in the pizza business.

Uploaded by

marishaek11
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)
6 views5 pages

Pizza Sales SQL Queries (AutoRecovered)

The document outlines SQL queries for analyzing pizza sales, including key performance indicators (KPIs) such as total revenue, average order value, and total pizzas sold. It also includes queries for generating charts to visualize daily and hourly trends, sales percentages by category and size, and identifying the top and bottom five best-selling pizzas. These queries provide insights into sales performance and customer preferences in the pizza business.

Uploaded by

marishaek11
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

Pizza Sales SQL Queries

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(quantity) as total_pizza_sold from pizza_sales

4. Total Orders

select count(distinct order_id) as total_orders from pizza_sales

5. Average pizza per order

select sum(quantity) / count(distinct order_id) as average_pizza_per_order from pizza_sales


B. CHARTS
Daily trend

select dayname(order_date) as order_day,

count(distinct order_id) as total_orders

from pizza_sales

group by dayname(order_date);

Hourly trend

select

hour(order_time ) as order_hours, count(distinct order_id) as total_orders

from pizza_sales

group by hour(order_time);
Percentage of sales per category

select

pizza_category, sum(total_price) * 100 / (select sum(total_price) from pizza_sales) as PCT

from pizza_sales

group by pizza_category

Percentage of sales per pizza size

select

pizza_size, sum(total_price) * 100 / (select sum(total_price) from pizza_sales) as PCT

from pizza_sales

group by pizza_size

order by PCT

Total pizza sold per category

select

pizza_category, sum(quantity) as total_pizza_per_category


from pizza_sales

group by pizza_category;

Top 5 best sellers

select

pizza_name, sum(quantity) as top_5_best_sellers

from pizza_sales

group by pizza_name

order by sum(quantity) desc

limit 5;

Top 5 worst sellers

select

pizza_name, sum(quantity) as top_5_worst_sellers

from pizza_sales

group by pizza_name

order by sum(quantity) asc

limit 5;

You might also like