{"id":15286448,"url":"https://github.com/deeksha-dhawan/pizza-outlet-analysis-using-sql","last_synced_at":"2025-03-23T21:22:38.451Z","repository":{"id":246586526,"uuid":"821536121","full_name":"deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL","owner":"deeksha-dhawan","description":"This project analyzes pizza sales data to gain insights into customer behavior and revenue patterns. Key analyses include customer insights, popular pizza types and sizes, revenue generation, and order trends. The findings help optimize menu offerings, staffing, and marketing strategies to boost overall business performance.","archived":false,"fork":false,"pushed_at":"2024-06-29T15:48:20.000Z","size":441,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T04:43:14.105Z","etag":null,"topics":["coding-challenge","data-analysis","data-science","microsoft","my","portfolio-project","programming","project","projects","sql","sql-analysis","sql-project","sqlproject","sqlserver"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deeksha-dhawan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-28T19:10:15.000Z","updated_at":"2024-06-29T15:48:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"c6d09cc0-b033-4f39-a4da-af17cfd6599c","html_url":"https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL","commit_stats":null,"previous_names":["deeksha-dhawan/pizza-outlet-analysis-using-sql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeksha-dhawan%2FPizza-Outlet-Analysis-using-SQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeksha-dhawan%2FPizza-Outlet-Analysis-using-SQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeksha-dhawan%2FPizza-Outlet-Analysis-using-SQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeksha-dhawan%2FPizza-Outlet-Analysis-using-SQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deeksha-dhawan","download_url":"https://codeload.github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245170115,"owners_count":20572007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coding-challenge","data-analysis","data-science","microsoft","my","portfolio-project","programming","project","projects","sql","sql-analysis","sql-project","sqlproject","sqlserver"],"created_at":"2024-09-30T15:14:16.587Z","updated_at":"2025-03-23T21:22:38.415Z","avatar_url":"https://github.com/deeksha-dhawan.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pizza Sales Analysis SQL Project \nSoftwares and Tools Used: Excel, MySQL\n\n## Table of Contents\n- [Project Overview](#project-overview)\n- [CSV Files](#csv-files)\n- [Database Schema](#database-schema)\n- [Questions I Wanted To Answer From the Dataset](#questions-i-wanted-to-answer-from-the-dataset)\n\n## Project Overview\nIn this project, we explore a dataset of pizza sales to derive meaningful insights. The analysis ranges from basic data exploration to advanced performance metrics, allowing us to understand sales trends, customer preferences, and more.\n\n* **How I Create Problems For Myself...:**\nI found these datasets on Kaggle and I analyzed these datasets as if I were the owner of a bustling pizza outlet. As an owner, I wanted to gather useful insights into pizza orders and customer preferences through datasets. \nSo I began asking questions to get to know my pizza outlet.\n\n* **... And How I Plan On Solving those Problems:**\nTo help extract meaningful insights from their extensive pizza orders dataset, I will utilize SQL for data extraction and analysis. By performing a series of SQL queries, I will uncover key metrics and trends. This structured analysis will provide actionable insights to refine their menu, optimize inventory, and enhance overall customer satisfaction.\nBy leveraging these data-driven insights, not only do I become the owner of the best pizza outlet in town but I can make informed decisions to drive business growth and improve the customer experience.\n\n## CSV Files\nThe dataset used in this project is available in the following CSV files located in the `data` folder:\n\n- [pizzas.csv](https://github.com/user-attachments/files/16040831/pizzas.csv): Contains information about the pizzas.\n- [pizza_types.csv](https://github.com/user-attachments/files/16040832/pizza_types.csv): Contains information about the different pizza types.\n- [orders.csv](https://github.com/user-attachments/files/16040833/orders.csv): Contains information about the orders.\n- [order_details.csv](https://github.com/user-attachments/files/16040837/order_details.csv): Contains details about the orders.\n\n## Database Schema\nThe database consists of the following tables:\n\n1. **Pizza**\n   - `pizza_id`: Unique identifier for each pizza\n   - `type`: Type of pizza\n   - `size`: Size of the pizza\n   - `price`: Price of the pizza\n\n2. **Pizza Type**\n   - `pizza_type_id`: Unique identifier for each pizza type\n   - `name`: Name of the pizza type\n   - `category`: Category of the pizza (e.g., vegetarian, non-vegetarian)\n   - `ingredients`: Ingredients of the pizza type\n\n3. **Orders**\n   - `order_id`: Unique identifier for each order\n   - `order_date`: Date when the order was placed\n   - `order_time`: Time when the order was placed\n\n4. **Order Details**\n   - `order_details_id`: Unique identifier for each order detail\n   - `order_id`: Unique identifier for each order (foreign key)\n   - `pizza_id`: Unique identifier for each pizza (foreign key)\n   - `quantity`: Quantity of the pizza ordered\n     \n\n## Questions I Wanted To Answer From the Dataset:\n\n### Order Trends\n\n1. **Retrieve the total number of orders placed.**\n   ```sql\n   SELECT COUNT(order_id) AS total_orders\n   FROM orders;\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/03bae979-121a-4e08-bbdd-f6106fb1b34f)\n   \nThe total number of orders placed provides an overview of customer activity and business performance. Here the total orders are 21,350, which indicates steady demand and customer engagement.\n\n2. **Determine the distribution of orders by hour of the day.**\n   ```sql\n   SELECT HOUR(order_time) AS hour, COUNT(order_id) AS frequency_of_orders\n   FROM orders\n   GROUP BY hour\n   ORDER BY frequency_of_orders DESC;\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/eeee8a3f-46ba-4ebf-83cc-860f3709bb88)\n\nAnalyzing the frequency of orders by hour reveals peak business hours. This can help optimize staffing and operational efficiency. Most orders are placed between 12 PM and 1 PM and then 4 PM to 6 PM, this time period is critical for maximizing service speed and customer satisfaction.\n\n3. **Analyze seasonal variations in pizza orders.**\n   ```sql\n   SELECT MONTH(order_date) AS month, COUNT(order_id) AS order_count\n   FROM orders\n   GROUP BY month\n   ORDER BY order_count DESC;\n\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/efdb733a-2121-49ef-be10-df0442dede7f)\n\n\nUnderstanding seasonal trends in orders can guide promotional strategies and menu adjustments. Here we see there is a spike in orders during July, therefore, launching seasonal specials during this period could boost sales further.\n\n4. **Identify the busiest day for orders.**\n   ```sql\n   SELECT orders.order_date, SUM(order_details.quantity) AS total_quantity\n   FROM orders\n   JOIN order_details ON orders.order_id = order_details.order_id\n   GROUP BY orders.order_date\n   ORDER BY total_quantity DESC\n   LIMIT 1;\n   \n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/745c4cc1-f967-4608-95b2-d08b3ec83dc3)\n\n### Revenue Analysis\n1. **Calculate the total revenue generated from pizza sales.**\n\n    ```sql\n    SELECT ROUND(SUM(order_details.quantity * pizzas.price),2) AS total_revenue\n    FROM order_details\n    JOIN pizzas\n    ON order_details.pizza_id = pizzas.pizza_id;\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/69a062e9-8b64-4e40-90be-015c37bc09c3)\n\nWe can calculate the total revenue rounded to 2 decimal places by simply using the above query and adding ROUND to it.\n    \n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/ef63d096-645f-4a25-82b0-a2a8196259f4)\n\nCalculating total revenue provides a measure of the business's financial performance. The total revenue is $817860.05, which indicates the overall sales success.\n\n2. **Determine the top 3 most ordered pizza types based on revenue.**\n   ```sql\n   SELECT pizza_types.name, SUM(order_details.quantity * pizzas.price) AS revenue\n   FROM pizza_types\n   JOIN pizzas ON pizza_types.pizza_type_id = pizzas.pizza_type_id\n   JOIN order_details ON order_details.pizza_id = pizzas.pizza_id\n   GROUP BY pizza_types.name\n   ORDER BY revenue DESC\n   LIMIT 3;\n\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/ec06d756-8e81-4ea7-8e8c-08f68138b189)\n\nIdentifying the top 3 pizza types by revenue highlights the most profitable items. Focusing on these pizzas in marketing campaigns can maximize profitability.\n\n3. **Calculate the percentage contribution of each pizza category to total revenue.**\n   ```sql\n   SELECT pizza_types.category, \n       SUM(order_details.quantity * pizzas.price) / (\n           SELECT SUM(order_details.quantity * pizzas.price)\n           FROM order_details \n           JOIN pizzas ON order_details.pizza_id = pizzas.pizza_id\n       ) * 100 AS revenue_percentage\n   FROM pizza_types\n   JOIN pizzas ON pizza_types.pizza_type_id = pizzas.pizza_type_id\n   JOIN order_details ON order_details.pizza_id = pizzas.pizza_id\n   GROUP BY pizza_types.category\n   ORDER BY revenue_percentage DESC;\n\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/2f6ba56f-6148-4f16-92df-87d6928795f3)\n\nAnalyzing the revenue contribution by category helps understand which categories drive the most sales. Classic pizzas contribute 26.91% of total revenue.\n\n4. **Identify the highest-priced pizza.**\n   ```sql\n   SELECT pizza_types.name, pizzas.price, pizza_types.ingredients\n   FROM pizza_types\n   INNER JOIN pizzas ON pizza_types.pizza_type_id = pizzas.pizza_type_id\n   ORDER BY pizzas.price DESC\n   LIMIT 1;\n\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/be016eab-75ae-4e35-8f71-3624aaee927b)\n\nKnowing the highest-priced pizza helps in pricing strategy and understanding customer spending behaviour. If the most expensive pizza is a speciality pizza with premium ingredients, highlighting its unique features can justify its price.\nAt this pizza outlet, we have the highest-priced pizza as The Greek Pizza which has Kalamata Olives, Feta Cheese, Tomatoes, Garlic, Beef Chuck Roast, and Red Onions as its ingredients making it pricey. \n\n### Pizza Preferences\n\n1. **Identify the most common pizza size ordered.**\n   ```sql\n   SELECT pizzas.size, COUNT(order_details.order_details_id) AS order_count\n   FROM pizzas\n   INNER JOIN order_details ON pizzas.pizza_id = order_details.pizza_id\n   GROUP BY pizzas.size\n   ORDER BY order_count DESC\n   LIMIT 1;\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/25c1d33c-fdb5-4305-8963-3432bccbb631)\n   \nKnowing the most popular pizza size helps in managing inventory and pricing strategies. The L i.e. LARGE size is the most popular, therefore ensuring a sufficient supply of its pizza ingredients is crucial.\n\n2. **List the top 5 most ordered pizza types along with their quantities.**\n   ```sql\n   SELECT pizza_types.name, SUM(order_details.quantity) AS total_quantity_ordered\n   FROM pizza_types\n   INNER JOIN pizzas ON pizza_types.pizza_type_id = pizzas.pizza_type_id\n   INNER JOIN order_details ON order_details.pizza_id = pizzas.pizza_id\n   GROUP BY pizza_types.name\n   ORDER BY total_quantity_ordered DESC\n   LIMIT 5;\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/cd50b945-380a-494d-bd0f-ea91e0b33ed6)\n   \nIdentifying the top 5 pizza types in terms of quantity ordered highlights customer favourites. This information is useful for menu optimization and targeted marketing campaigns.\n\n3. **Find the total quantity of each pizza category ordered.**\n   ```sql\n   SELECT pizza_types.category, SUM(order_details.quantity)\n   FROM pizza_types\n   INNER JOIN pizzas ON pizza_types.pizza_type_id = pizzas.pizza_type_id\n   JOIN order_details ON pizzas.pizza_id = order_details.pizza_id\n   GROUP BY pizza_types.category;\n\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/ac0a4031-e112-4588-ae7a-90ecfba5441d)\n   \nAnalyzing the total quantity ordered by pizza category helps understand customer preferences for different pizza styles. Classic pizzas are highly popular, so expanding this category could attract more customers.\n\n4. **Analyze customer preferences by pizza category. Identify the least and most popular pizza categories.**\n   ```sql\n   SELECT pizza_types.category, SUM(order_details.quantity)\n   FROM pizza_types\n   INNER JOIN pizzas ON pizza_types.pizza_type_id = pizzas.pizza_type_id\n   INNER JOIN order_details ON pizzas.pizza_id = pizzas.pizza_id\n   GROUP BY pizza_types.category\n   ORDER BY SUM(order_details.quantity);\n\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/4eee21e7-bfd8-4d71-961e-005a7fcdda3a)\n\nIdentifying the least and most popular pizza categories provides insights into customer preferences and areas for menu improvement. Veggie pizzas are the least popular, SO WWE MIGHT HAVE TO reconsider their recipes or pricing might be necessary.\n\n5. **How many pizza types are there in total?**\n   ```sql\n   SELECT COUNT(pizza_type_id) AS total_pizza_types FROM pizza_types;\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/bbda71e7-8760-4505-b398-936f0b9399b1)\n\nKnowing the total number of pizza types available helps in understanding the variety offered to customers. We have 32 different pizza types, which indicates a diverse menu catering to various tastes and preferences. This variety can attract a wider customer base and meet different customer needs, enhancing overall customer satisfaction.\n\n### Customer Insights\n\n1. **Calculate the average number of pizzas ordered per day.**\n   ```sql\n   SELECT AVG(quantity)\n   FROM (SELECT orders.order_date AS date, SUM(order_details.quantity) AS quantity\n   FROM orders\n   JOIN order_details ON orders.order_id = order_details.order_id\n   GROUP BY date) AS daily_quantities;\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/0996424d-585c-449e-ab82-495de7ae5cdd)\n\n2. **Identify repeat customers based on order frequency.**\n   ```sql\n   SELECT order_id, COUNT(order_id)\n   FROM order_details\n   GROUP BY order_id\n   HAVING COUNT(order_id) \u003e 1\n   ORDER BY COUNT(order_id) DESC;\n\n\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/dc127289-f65b-44f9-879d-f6a63a52710f)\n\n*The table is quite long for this one, so I could not upload it entirely.*\n\n\nIdentifying repeat customers helps in understanding customer loyalty and designing loyalty programs.\n\n\n3. **Analyze the cumulative revenue generated over time.**\n\n   ```sql\n   SELECT order_date, \n       SUM(revenue) OVER (ORDER BY order_date) AS cumulative_revenue\n   FROM (\n    SELECT orders.order_date, \n           SUM(order_details.quantity * pizzas.price) AS revenue\n    FROM order_details\n    JOIN pizzas ON order_details.pizza_id = pizzas.pizza_id\n    JOIN orders ON order_details.order_id = orders.order_id\n    GROUP BY orders.order_date\n   ) AS daily_revenues;\n\n![image](https://github.com/deeksha-dhawan/Pizza-Outlet-Analysis-using-SQL/assets/174144967/6a6efe0a-f81e-42fd-bdfd-2af582bd8ab8)\n\n*The table is quite long for this one, so I could not upload it entirely.*\n\n\nAnalyzing cumulative revenue over time helps track business growth and identify trends. The revenue shows a steady increase month over month, it indicates positive business momentum.\n\n## Contact\nFor any questions or suggestions, feel free to reach out to me at [dk.dhawan555@gmail.com].\n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeksha-dhawan%2Fpizza-outlet-analysis-using-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeeksha-dhawan%2Fpizza-outlet-analysis-using-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeksha-dhawan%2Fpizza-outlet-analysis-using-sql/lists"}