{"id":50601923,"url":"https://github.com/ayushi-gajendra/restaurant-order-analysis-sql","last_synced_at":"2026-06-05T19:01:11.098Z","repository":{"id":339643633,"uuid":"1162750345","full_name":"ayushi-gajendra/restaurant-order-analysis-sql","owner":"ayushi-gajendra","description":"End-to-end SQL analysis of 12,266 restaurant transactions to identify high-performing menu items, revenue concentration, bulk ordering behavior, and strategic growth opportunities.","archived":false,"fork":false,"pushed_at":"2026-03-02T18:10:33.000Z","size":254,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-02T21:53:11.878Z","etag":null,"topics":["analytics-portfolio","business-intelligence","case-study","customer-segmentation","data-analysis","data-analytics","database-analysis","menu-engineering","mysql","revenue-analysis","sql","sql-project"],"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/ayushi-gajendra.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-20T16:43:25.000Z","updated_at":"2026-03-02T18:10:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ayushi-gajendra/restaurant-order-analysis-sql","commit_stats":null,"previous_names":["ayushi-gajendra/restaurant-order-analysis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ayushi-gajendra/restaurant-order-analysis-sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushi-gajendra%2Frestaurant-order-analysis-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushi-gajendra%2Frestaurant-order-analysis-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushi-gajendra%2Frestaurant-order-analysis-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushi-gajendra%2Frestaurant-order-analysis-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayushi-gajendra","download_url":"https://codeload.github.com/ayushi-gajendra/restaurant-order-analysis-sql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayushi-gajendra%2Frestaurant-order-analysis-sql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33955543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["analytics-portfolio","business-intelligence","case-study","customer-segmentation","data-analysis","data-analytics","database-analysis","menu-engineering","mysql","revenue-analysis","sql","sql-project"],"created_at":"2026-06-05T19:01:10.328Z","updated_at":"2026-06-05T19:01:11.091Z","avatar_url":"https://github.com/ayushi-gajendra.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🍽️ Restaurant Order Analysis: Culinary Data Science  \n\n### An End-to-End SQL Project Exploring Customer Behavior and Menu Profitability\n\n![SQL](https://img.shields.io/badge/Language-SQL-blue?style=for-the-badge\u0026logo=mysql\u0026logoColor=white)\n![Data Analysis](https://img.shields.io/badge/Analysis-Exploratory%20Data%20Analysis-orange?style=for-the-badge)\n![Business Intelligence](https://img.shields.io/badge/Domain-Hospitality%20%26%20F%26B-green?style=for-the-badge)\n![Database](https://img.shields.io/badge/Database-MySQL%20%2F%20PostgreSQL-lightgrey?style=for-the-badge\u0026logo=database\u0026logoColor=white)\n\n\n---\n\n## 📌 Project Overview\n\nThe \"**Taste of the World Cafe**\" introduced a new international menu at the beginning of the year.  \nManagement wants to understand how customers are responding to the updated offerings and which menu items are driving profitability.\n\nThis project analyzes **12,266 transactional records** from Q1 (January–March 2023) to answer critical business questions:\n\n- Which cuisines generate the most revenue?\n- Which items are popular vs. profitable?\n- Are there bulk ordering patterns?\n- What is the highest-value order in the dataset?\n- Where are there opportunities for strategic improvement?\n\nUsing advanced SQL techniques — including **CTEs, Window Functions, Subqueries, Aggregations, and Revenue Analysis** — this project translates raw operational data into actionable insights.\n\n---\n\n## 📊 Dataset Overview\n\n- **Database:** MySQL  \n- **Schema:** `restaurant_db`  \n- **Timeframe:** January – March 2023  \n- **Records:** 12,266  \n- **Tables:** `menu_items`, `order_details`\n\n### `menu_items`\n| Column | Description |\n|--------|------------|\n| menu_item_id | Unique dish identifier |\n| item_name | Name of dish |\n| category | Cuisine category |\n| price | Dish price |\n\n### `order_details`\n| Column | Description |\n|--------|------------|\n| order_id | Unique order identifier |\n| order_date | Date of transaction |\n| order_time | Time of transaction |\n| item_id | Linked dish ID |\n\n---\n\n## 🎯 Objective 1: Understanding the Menu Structure\n\nBefore analyzing customer behavior, it’s important to understand the pricing architecture and composition of the menu itself.\n\n---\n\n### 🔎 Explore Menu Structure\n\nWe first inspect the table to understand available columns and data types.\n\n```sql\nSELECT * FROM menu_items;\n```\n\n---\n\n### 📌 How Many Items Are on the Menu?\n\nUnderstanding menu size helps contextualize demand concentration and pricing spread.\n\n```sql\nSELECT COUNT(*) AS total_menu_items\nFROM menu_items;\n```\n\n---\n\n### 💰 What Are the Least \u0026 Most Expensive Items?\n\nPricing extremes reveal premium positioning and potential margin drivers.  \nUsing `DENSE_RANK()` ensures ties are handled fairly.\n\n```sql\nWITH price_rank AS (\n    SELECT \n        item_name,\n        category,\n        price,\n        DENSE_RANK() OVER(ORDER BY price DESC) AS expensive_rank,\n        DENSE_RANK() OVER(ORDER BY price ASC) AS cheapest_rank\n    FROM menu_items\n)\nSELECT *\nFROM price_rank\nWHERE expensive_rank = 1 OR cheapest_rank = 1;\n```\n\n---\n\n### 🍝 Italian Cuisine Pricing Analysis\n\nItalian cuisine often carries strong demand in international restaurants.  \nWe evaluate its price range and positioning within the menu.\n\n```sql\nSELECT \n    COUNT(*) AS total_italian_dishes,\n    MIN(price) AS cheapest_italian_item,\n    MAX(price) AS most_expensive_italian_item,\n    ROUND(AVG(price),2) AS avg_italian_price\nFROM menu_items\nWHERE category = 'Italian';\n```\n\n---\n\n### 📊 Category Distribution \u0026 Pricing Strategy\n\nThis helps determine whether certain cuisines are positioned as premium, mid-tier, or budget offerings.\n\n```sql\nSELECT \n    category,\n    COUNT(*) AS total_items,\n    ROUND(AVG(price), 2) AS avg_dish_price\nFROM menu_items\nGROUP BY category\nORDER BY avg_dish_price DESC;\n```\n\n---\n\n## 🎯 Objective 2: Understanding Order Patterns\n\nAfter understanding pricing structure, we analyze transaction behavior and operational volume.\n\n---\n\n### 📅 What Is the Date Range?\n\nThis validates time coverage and ensures no data gaps.\n\n```sql\nSELECT \n    MIN(order_date) AS first_order,\n    MAX(order_date) AS last_order\nFROM order_details;\n```\n\n---\n\n### 📦 How Many Orders \u0026 Items Were Sold?\n\nThis measures operational scale and throughput.\n\n```sql\nSELECT \n    COUNT(DISTINCT order_id) AS total_orders,\n    COUNT(*) AS total_items_sold\nFROM order_details;\n```\n\n---\n\n### 🏆 Which Orders Had the Most Items?\n\nLarge item counts may indicate catering, group dining, or high-value customers.\n\n```sql\nSELECT \n    order_id,\n    COUNT(*) AS num_items\nFROM order_details\nGROUP BY order_id\nORDER BY num_items DESC;\n```\n\n---\n\n### 📈 How Many Orders Had More Than 12 Items?\n\nQuantifying bulk orders helps assess catering potential.\n\n```sql\nSELECT COUNT(*) AS large_orders\nFROM (\n    SELECT order_id\n    FROM order_details\n    GROUP BY order_id\n    HAVING COUNT(*) \u003e 12\n) AS bulk_orders;\n```\n\n---\n\n## 🎯 Objective 3: Customer Behavior \u0026 Revenue Analysis\n\nThis is where pricing and order behavior intersect to generate business insight.\n\n---\n\n### 🔗 Combine Menu \u0026 Order Data\n\nTo connect revenue with item-level behavior:\n\n```sql\nSELECT \n    o.order_id,\n    o.order_date,\n    m.item_name,\n    m.category,\n    m.price\nFROM order_details o LEFT JOIN menu_items m\n     ON o.item_id = m.menu_item_id;\n```\n\n---\n\n### 📊 Most \u0026 Least Ordered Items (Volume + Revenue)\n\nVolume alone doesn’t tell the full story — revenue contribution is equally important.\n\n```sql\nSELECT \n    m.item_name,\n    m.category,\n    COUNT(*) AS times_ordered,\n    SUM(m.price) AS total_revenue\nFROM order_details o LEFT JOIN menu_items m\n     ON o.item_id = m.menu_item_id\nGROUP BY m.item_name, m.category\nORDER BY times_ordered DESC;\n```\n\nThis reveals:\n- Popular but low-priced items  \n- Premium items with fewer but high-value purchases  \n- Revenue concentration by dish  \n\n---\n\n### 💵 Top 5 Highest-Spending Orders\n\nIdentifying top spenders helps understand revenue concentration and customer value.\n\n```sql\nSELECT \n    o.order_id,\n    SUM(m.price) AS total_spend\nFROM order_details o LEFT JOIN menu_items m\n     ON o.item_id = m.menu_item_id\nGROUP BY o.order_id\nORDER BY total_spend DESC\nLIMIT 5;\n```\n\n---\n\n### 🥇 Inspect the Highest Spend Order\n\nTo understand purchasing composition and bundle patterns:\n\n```sql\nWITH highest_order AS (\n    SELECT \n        o.order_id,\n        SUM(m.price) AS total_spend\n    FROM order_details o LEFT JOIN menu_items m\n         ON o.item_id = m.menu_item_id\n    GROUP BY o.order_id\n    ORDER BY total_spend DESC\n    LIMIT 1\n)\n\nSELECT \n    o.order_id,\n    m.item_name,\n    m.category,\n    m.price\nFROM order_details o LEFT JOIN menu_items m\n     ON o.item_id = m.menu_item_id\nWHERE o.order_id = (SELECT order_id FROM highest_order);\n```\n\n---\n\n# ✅ Final Validation\n\n## ❓ What Was the Most Expensive Order?\n\n```sql\nSELECT \n    MAX(order_total) AS highest_order_value\nFROM (\n    SELECT \n        o.order_id,\n        SUM(m.price) AS order_total\n    FROM order_details o LEFT JOIN menu_items m\n         ON o.item_id = m.menu_item_id\n    GROUP BY o.order_id\n) AS order_totals;\n```\n\n---\n\n## 📋 Analytical Bias Audit\n\n| Stage | Risk | Mitigation |\n|-------|------|------------|\n| Data Scope | Seasonal bias (Q1 only) | Interpreted findings within limited timeframe |\n| Ranking | Tie bias | Used `DENSE_RANK()` for fairness |\n| Interpretation | Popularity bias | Compared volume and revenue |\n\n---\n\n## 💡 Strategic Recommendations\n\n### 1️⃣ Premium Bundle Strategy for High-Revenue Categories\nItalian cuisine shows strong pricing leverage and revenue potential.  \nIntroduce curated premium bundles (e.g., “Italian Dinner Experience”) that package appetizers, mains, and desserts to increase Average Order Value (AOV).\n\n---\n\n### 2️⃣ Menu Engineering Optimization\nSegment items into:\n- High Volume / High Revenue (Stars)\n- High Volume / Low Revenue (Traffic Drivers)\n- Low Volume / High Revenue (Premium Niche)\n- Low Volume / Low Revenue (Candidates for removal)\n\nUse this framework to:\n- Reposition underperforming items  \n- Adjust pricing where demand is inelastic  \n- Improve menu layout prominence  \n\n---\n\n### 3️⃣ Corporate \u0026 Group Targeting Strategy\nOrders with more than 12 items indicate group purchasing behavior.  \nDevelop:\n- Corporate lunch packages  \n- Event catering bundles  \n- Pre-set group menus  \n\nThis captures predictable bulk revenue streams.\n\n---\n\n### 4️⃣ Revenue Concentration Monitoring\nIf a small percentage of orders contributes disproportionately to revenue, consider:\n- Loyalty programs for high spenders  \n- Personalized offers  \n- Upsell prompts at checkout  \n\n---\n\n## 📈 Skills Demonstrated\n\n- Advanced SQL (CTEs, Window Functions, Subqueries)\n- Revenue Analysis \u0026 KPI Computation\n- Customer Segmentation\n- Menu Engineering Concepts\n- Business Strategy Translation\n- Analytical Bias Awareness\n- Data Storytelling\n\n---\n\n## 📚 Credits\n\nThe dataset and initial project inspiration were adapted from guided SQL case studies provided by **Maven Analytics**.\n\nThis implementation, analysis approach, business framing, and strategic recommendations were independently developed and expanded upon as part of my SQL portfolio work.\n\n🔗 https://mavenanalytics.io/\n\n---\n\n## 👩‍💻 Author\n\n**Ayushi Gajendra**  \nSQL • Data Analytics • Business Intelligence  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayushi-gajendra%2Frestaurant-order-analysis-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayushi-gajendra%2Frestaurant-order-analysis-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayushi-gajendra%2Frestaurant-order-analysis-sql/lists"}