Pizza Sales: A Deep Dive with SQL

Overview

This project delves into a pizza sales dataset using MySQL to uncover key trends, customer preferences, and revenue insights. By leveraging various SQL queries, I explored various questions, from basic sales metrics to advanced revenue analysis. The dataset, flip_n_pizza, contains information about pizza types, orders, and order details, allowing for a comprehensive analysis of sales patterns.

Problem Statement/Business Questions:

This project aimed to answer the following business questions:


Basic Questions:

  • What is the total number of orders placed?
  • What is the total revenue generated from pizza sales?
  • Which pizza has the highest price?
  • What is the most common pizza size ordered?
  • What are the top 5 most-ordered pizza types, and what are their quantities?


Intermediate Questions:

  • What is the total quantity of each pizza category ordered?
  • How are orders distributed throughout the hours of the day?
  • What is the category-wise distribution of pizzas?
  • What is the average number of pizzas ordered per day?
  • What are the top 3 most-ordered pizza types based on revenue?


Advanced Questions:

  • What percentage does each pizza type contribute to the total revenue?
  • How has revenue accumulated over time?
  • What are the top 3 most ordered pizza types by revenue for each pizza category?

Methodology & SQL Queries:

To address these questions, I employed a variety of SQL techniques, including:


  • Data Aggregation: Using aggregate functions like SUM, COUNT, and AVG to calculate totals, averages, and frequencies.
  • Joins: Joining tables like pizza_types, pizzas, order_details, and orders to combine relevant data for analysis.
  • Subqueries: Utilizing subqueries to perform calculations within queries.
  • Window Functions: Using window functions to calculate cumulative sums and ranks.


Key Findings

Basic:

  • Total orders placed: 21,350
  • Total revenue generated: $817,860.05
  • Highest-priced pizza: The Greek Pizza ($35.95)
  • Most common pizza size: most-orderedL (18,526)
  • Top 5 most ordered pizza types:
    • The Classic Deluxe Pizza (2,453)
    • The Barbecue Chicken Pizza (2,432)
    • The Hawaiian Pizza (2,422)
    • The Pepperoni Pizza (2,418)
    • The Thai Chicken Pizza (2,371)


Intermediate:

  • Total quantity of each pizza category:
    • Classic: 14,888
    • Supreme: 11,987
    • Veggie: 11,649
    • Chicken: 11,050
  • Order distribution by hour: Peak hours are between 11 AM and 9 PM, with the highest order volume at noon.
  • Category-wise pizza distribution:
    • Classic: 8
    • Supreme: 9
    • Veggie: 9
    • Chicken: 6
  • Average pizzas ordered per day: 138
  • Top 3 pizzas by revenue:

1. The Thai Chicken Pizza ($43,434.25)

2. The Barbecue Chicken Pizza ($42,768)

3. The California Chicken Pizza ($41,409.5)

Advanced:

  • Percentage contribution of each pizza category to total revenue:
    • Classic: 26.91%
    • Supreme: 25.46%
    • Chicken: 23.96%
    • Veggie: 23.68%
  • Cumulative revenue over time: Revenue shows a steady increase over the analyzed period.
  • Top 3 pizzas by revenue for each category:
    • Chicken:
      • The Thai Chicken Pizza
      • The Barbecue Chicken Pizza
      • The California Chicken Pizza
    • Classic:
      • The Classic Deluxe Pizza
      • The Hawaiian Pizza
      • The Pepperoni Pizza
    • Supreme:
      • The Spicy Italian Pizza
      • The Italian Supreme Pizza
      • The Sicilian Pizza
    • Veggie:
      • The Four Cheese Pizza
      • The Mexicana Pizza
      • The Five Cheese Pizza

Conclusion & Reflections:

This project provided valuable insights into pizza sales trends. The analysis revealed the most popular pizza types, peak ordering hours, and the performance of different pizza categories. These findings can be leveraged to optimize inventory management, marketing strategies, and menu design.

Challenges:

  • Dealing with large datasets and complex queries required careful optimization for efficient processing.
  • Ensuring data accuracy and consistency was crucial for reliable analysis.

Learning:

  • This project enhanced my SQL skills, particularly in data aggregation, joins, subqueries, and window functions.
  • It reinforced the importance of data analysis in understanding business trends and making informed decisions.


This project demonstrates the power of SQL in extracting meaningful insights from data and driving business decisions. By continuing to explore and analyze data, businesses can gain a competitive edge and better serve their customers.

YOU MIGHT LIKE


Website_large _logo

© Hrishikesh 2025. All rights reserved.

About me

Beyond the spreadsheets and dashboards, I'm a lifelong learner, always eager to explore new technologies and expand my skills, fueled by a passion for both data analysis and a good story (whether it's in a comic or a dataset).