SQL Project : Downloaded Pizza
sales dataset from www.kaggle.com
1. Total revenue from pizzas sold
SQL query used :- Select SUM(total_price) AS Total_revenue from
Pizza_sales;
1. Total quantity of pizzas sold
SQL
Query used is:- Select
SUM(quantity) AS Total_pizza_sold from Pizza_sales;
1. How many unique customer orders were made.
SQL
Query used is:- Select
count(distinct order_id) As Unique_customers from Pizza_sales;
1. Find out the average order value
SQL
Query used is:- Select
sum(total_price)/count(distinct order_id) as average_order_value from
Pizza_sales;
5. Find the daily trends of Sales of pizza
SQL
Query used is:- Select
DATENAME(DW, order_date) as order_day, COUNT(DISTINCT order_id) as Total_oders
from Pizza_sales; GROUP BY DATENAME(DW,order_date);
5. Find out the Hourly rate of pizza sales
SQL Query used is:- SELECT DATEPART(HOUR,order_time) AS
order_hour, COUNT(distinct order_id)
as total_order from Pizza_sales
Group BY
DATEPART(HOUR,order_time)
ORDER BY DATEPART(HOUR,order_time);
5. Find out the %
sales as per pizza category
SQL
Query used is:- SELECT
pizza_category, sum(total_price)*100 /(select sum(total_price) from Pizza_sales
) AS Percentage_of_sales from Pizza_sales
GROUP BY pizza_category ;
5. Find out the %
sales month wise as per pizza category
SQL
Query used is:- SELECT
pizza_category, sum(total_price)*100 /(select sum(total_price) from Pizza_sales
where Month(order_date) =1) AS Percentage_of_sales from Pizza_sales
WHERE Month(order_date) =1
GROUP BY pizza_category ;
By changing the month(order_date) = 1 to 12 we will
get for all the months required
5. Find out the most pizza sold as per total order and also
count of order.
SQL
Query used is:- SELECT pizza_name, COUNT(DISTINCT order_id) AS total_orders from Pizza_sales GROUP BY pizza_name ORDER BY
total_orders desc;
5. Find out the the
top month wise as per no of order and total revenue in desc order of
revenue
SQL Query used is:- SELECT
DATENAME(MONTH, order_date) AS Month,COUNT (order_id) AS Number_of_Orders,ROUND
(SUM (total_price),2) AS Total_revenue FROM Pizza_sales GROUP BY
DATENAME(MONTH, order_date)
Order by
Total_revenue desc;
5. Find out the orders of pizzas day wise of the week as
show the Total Order, revenue and pizzas sold
SQL Query used is:- SELECT DATENAME (WEEKDAY, order_date) AS
Day_of_Week, COUNT (distinct order_id) AS Number_of_Orders,SUM (quantity) AS
Number_of_Pizzas, ROUND (SUM (total_price),2) AS Total_revenue
FROM Pizza_sales
GROUP BY DATENAME
(WEEKDAY, order_date)
ORDER BY Number_of_Pizzas DESC;
Comments
Post a Comment