This project focuses on analyzing pizza sales data using SQL to uncover valuable business insights.
The analysis includes:
- Revenue trends
- Popular pizza types and sizes
- Order distribution by time
- Category-wise contributions
These insights can help optimize menu offerings and improve decision-making.
To analyze pizza sales data and answer key business questions such as:
- ✅ What is the total revenue generated?
- ✅ Which is the most popular pizza size?
- ✅ What are the top-selling pizza types?
- ✅ When is the peak ordering time?
- ✅ Which pizzas contribute the most to revenue?
The dataset consists of 4 tables:
1. orders
order_id– Unique identifier for each orderdate– Date of the ordertime– Time of the order
2. order_details
order_id– Foreign key referencing orderspizza_id– Foreign key referencing pizzasquantity– Number of pizzas ordered
3. pizzas
pizza_id– Unique identifier for pizzapizza_type_id– Links to pizza typesize– Pizza size (S, M, L, XL)price– Price of the pizza
4. pizza_types
pizza_type_id– Unique pizza type identifiername– Pizza namecategory– Category of pizza (Veg, Non-Veg, etc.)ingredients– Ingredients used
- Database: MySQL
- Queries: SELECT, JOIN, GROUP BY, ORDER BY, Aggregate Functions, Window Functions
✔ Total Orders & Revenue
✔ Highest Priced Pizza
✔ Most Common Pizza Size
✔ Top 5 Most Ordered Pizza Types
✔ Category-wise Quantity Sold
✔ Distribution of Orders by Hour
✔ Average Pizzas per Day
✔ Top 3 Pizzas by Revenue
✔ Percentage Contribution of Each Pizza Type
✔ Cumulative Revenue Over Time
✔ Top 3 Pizzas by Revenue per Category
✔ Total Orders: 21,350
✔ Total Revenue: $817,860
✔ Most Popular Size: Large
✔ Peak Ordering Time: 12 PM – 1 PM
✔ Top Pizza by Revenue: Thai Chicken Pizza
- Retrieve the total number of orders placed.
- Calculate the total revenue generated from pizza sales.
- Identify the highest-priced pizza.
- Identify the most common pizza size ordered.
- List the top 5 most ordered pizza types along with their quantities.
- Total quantity of each pizza category ordered.
- Distribution of orders by hour of the day.
- Category-wise distribution of pizzas.
- Average pizzas ordered per day.
- Top 3 pizza types by revenue.
- Percentage contribution of each pizza type to revenue.
- Cumulative revenue over time.
- Top 3 pizza types by revenue in each category.
SELECT COUNT(order_id) AS total_orders FROM orders;
SELECT ROUND(SUM(orders_details.quantity * pizzas.price), 2) AS total_sales FROM orders_details JOIN pizzas ON pizzas.pizza_id = orders_details.pizza_id;
SELECT pizza_types.name, pizzas.price FROM pizza_types JOIN pizzas ON pizza_types.pizza_type_id = pizzas.pizza_type_id ORDER BY pizzas.price DESC LIMIT 1;
(📌 Full queries available in pizza_sales_analysis.sql file)
For detailed SQL queries, outputs, and analysis screenshots, check the full project report:
SQL Queries & Outputs (PDF)
📂 Project Structure
Pizza-Sales-SQL-Project/
│
├── README.md
├── LICENSE
├── pizza_sales_analysis.sql # Combined SQL file (all queries)
├── Questions List.txt # List of all questions
├── SQL_Queries_and_Outputs.pdf # PDF report with query & output screenshots
├── queries/ # Individual query files
│ ├── Question 1.sql
│ ├── Question 2.sql
│ └── ... Question 13.sql
├── dataset/ # CSV files
│ ├── orders.csv
│ ├── orders_details.csv
│ ├── pizzas.csv
│ └── pizza_types.csv
▶ How to Run Install MySQL and create a database. Import the pizza sales dataset (tables: orders, order_details, pizzas, pizza_types). Run queries from pizza_sales_analysis.sql file in MySQL Workbench or any SQL client.
🏷 Tags #SQL #DataAnalysis #MySQL #PizzaSales #PortfolioProject #BusinessInsights
👤 Author Faizan Shaikh 📌 LinkedIn Profile | 📌 GitHub Profile ✅ Live GitHub Repository