This repository contains SQL queries for analyzing pizza sales data. The queries range from basic to advanced analysis, providing comprehensive insights into sales patterns, revenue generation, and customer preferences in a pizza business.
The analysis is performed on a pizza sales database containing information about:
- Pizza orders
- Pizza types and categories
- Order dates and times
- Sales amounts
- Quantities sold
sql1.sql: Total order count analysis - Retrieves the total number of orders placedsql2.sql: Revenue calculation - Calculates the total revenue generated from all pizza salessql3.sql: Price analysis - Identifies the highest-priced pizza in the menusql4.sql: Size preference analysis - Identifies the most commonly ordered pizza sizesql5.sql: Top performers - Lists the top 5 most ordered pizza types with their quantities
sql6.sql: Category-wise quantity analysis - Joins tables to find total quantity ordered per pizza categorysql7.sql: Hourly order distribution - Determines the distribution of orders by hour of the daysql8.sql: Category distribution - Analyzes the distribution of pizzas across different categoriessql9.sql: Daily order patterns - Calculates the average number of pizzas ordered per daysql10.sql: Revenue-based ranking - Identifies the top 3 most ordered pizza types based on revenue
sql11.sql: Revenue contribution analysis - Calculates the percentage contribution of each pizza type to total revenuesql12.sql: Time-based revenue analysis - Analyzes cumulative revenue generation over timesql13.sql: Category-wise performance - Determines the top 3 revenue-generating pizza types for each category
- Overall Business Performance
- Total order volume
- Total revenue
- Peak business hours
- Product Analysis
- Most popular pizza sizes
- Best-selling pizza types
- Highest revenue-generating products
- Category Performance
- Category-wise sales distribution
- Top performers in each category
- Time-Based Analysis
- Daily order patterns
- Revenue trends over time
- Peak hours identification
- Set up a SQL database server (MySQL, PostgreSQL, etc.)
- Import the pizza sales dataset
- Execute queries in the following order:
- Start with basic analysis (sql1.sql to sql5.sql)
- Move to intermediate queries (sql6.sql to sql10.sql)
- Finally, run advanced analysis queries (sql11.sql to sql13.sql)
- Analyze the results for business insights
- SQL Server/MySQL/
- Basic understanding of SQL queries
- Pizza sales dataset
- Basic SQL operations (SELECT, WHERE, GROUP BY)
- Advanced SQL concepts (JOINs, Subqueries)
- Data aggregation and analysis
- Time-based analysis
- Percentage calculations
- Cumulative calculations