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

Pizza Sales SQL Queries

The document outlines various SQL queries to analyze pizza sales data including total sales, average order value, sales by category, size, day of week and hour. It also lists top and bottom selling pizzas by revenue, quantity and total orders.

Uploaded by

c navya nirmala
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)
39 views6 pages

Pizza Sales SQL Queries

The document outlines various SQL queries to analyze pizza sales data including total sales, average order value, sales by category, size, day of week and hour. It also lists top and bottom selling pizzas by revenue, quantity and total orders.

Uploaded by

c navya nirmala
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/ 6

PIZZA SALES SQL QUERIES

A) KPI’s:
1. Total sales:
select sum(total_price) as total_revenue from pizza_sales

2. Average order value:


select sum(total_price) / count(distinct order_id) as Average_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 pizzas per order:


select cast(sum(quantity) as decimal(10,2))/cast(count(distinct order_id) as decimal(10,2)) as
Average_pizzas_per_order from pizza_sales;

B) Daily Trend for Total orders:


SELECT DAYNAME(STR_TO_DATE(order_date, '%d-%m-%Y')) AS order_day, count(distinct
order_id) as total_orders

FROM pizza_sales

group by DAYNAME(STR_TO_DATE(order_date, '%d-%m-%Y'))

ORDER BY total_orders DESC;


C) Hourly Trend for Total orders:
SELECT

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

FROM pizza_sales

GROUP BY hour(order_time)

ORDER BY total_orders DESC;

D)Monthly Trend for Total orders:


SELECT

MONTHNAME(STR_TO_DATE(order_date, '%d-%m-%Y')) AS order_month, count(distinct


order_id) AS total_orders

FROM pizza_sales

GROUP BY order_month

ORDER BY total_orders DESC;


E) % of sales by pizza category:
SELECT pizza_category,sum(total_price) as tota_sales, sum(total_price) *100 / (select
sum(total_price) from pizza_sales) as PCT

from pizza_sales

group by pizza_category;

F)% of sales by pizza size:


SELECT pizza_size ,CAST(sum(total_price) AS DECIMAL (10,2)) as tota_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;

G) Total of sales by pizza category:


SELECT pizza_category, SUM(quantity) AS total_quantity_sold
FROM pizza_sales

GROUP BY pizza_category

ORDER BY total_quantity_sold DESC;

H)Top 5 best sellers by revenue:


SELECT pizza_name , sum(total_price) as total_revenue from pizza_sales

group by pizza_name

order by total_revenue desc

LIMIT 5;

Bottom 5 best sellers by revenue:


SELECT pizza_name , sum(total_price) as total_revenue from pizza_sales

group by pizza_name

order by total_revenue

LIMIT 5;

I)Top 5 best sellers by quantity:


SELECT pizza_name , sum(quantity) as total_quantity from pizza_sales

group by pizza_name

order by total_quantity desc


LIMIT 5;

Bottom 5 best sellersby quantity:


SELECT pizza_name , sum(quantity) as total_quantity from pizza_sales

group by pizza_name

order by total_quantity

LIMIT 5;

J) Top 5 best sellers by total orders:


SELECT pizza_name , count(distinct order_id) as total_orders from pizza_sales

group by pizza_name

order by total_orders desc

LIMIT 5;

Bottom 5 best sellers by total orders:


SELECT pizza_name , count(distinct order_id) as total_orders from pizza_sales

group by pizza_name

order by total_orders

LIMIT 5;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy