{"id":28509772,"url":"https://github.com/shrunga92/restaurant_order_analysis_sql","last_synced_at":"2025-07-03T01:31:23.730Z","repository":{"id":285197938,"uuid":"957356658","full_name":"shrunga92/Restaurant_Order_Analysis_SQL","owner":"shrunga92","description":"This project is a structured SQL-based analysis of restaurant orders, aimed at deriving key insights from transactional data. ","archived":false,"fork":false,"pushed_at":"2025-03-30T08:29:30.000Z","size":123,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-08T22:33:27.985Z","etag":null,"topics":["data-analysis","sql"],"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/shrunga92.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":"2025-03-30T06:43:54.000Z","updated_at":"2025-03-30T08:29:34.000Z","dependencies_parsed_at":"2025-03-30T08:23:38.621Z","dependency_job_id":"7d20c2eb-1ebe-4053-80ad-af7975f60202","html_url":"https://github.com/shrunga92/Restaurant_Order_Analysis_SQL","commit_stats":null,"previous_names":["shrunga92/restaurant_order_analysis_sql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shrunga92/Restaurant_Order_Analysis_SQL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrunga92%2FRestaurant_Order_Analysis_SQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrunga92%2FRestaurant_Order_Analysis_SQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrunga92%2FRestaurant_Order_Analysis_SQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrunga92%2FRestaurant_Order_Analysis_SQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shrunga92","download_url":"https://codeload.github.com/shrunga92/Restaurant_Order_Analysis_SQL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shrunga92%2FRestaurant_Order_Analysis_SQL/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263243634,"owners_count":23436341,"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":["data-analysis","sql"],"created_at":"2025-06-08T22:30:51.420Z","updated_at":"2025-07-03T01:31:23.716Z","avatar_url":"https://github.com/shrunga92.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Restaurant Order Analysis using SQL\n\n![heading](https://github.com/user-attachments/assets/ad0114d3-d2ad-4811-a5a1-cc581c0a3ca3)\n\nThis project is a structured SQL-based analysis of restaurant orders, aimed at deriving key insights from transactional data. \n\n\n# Project Brief\n![objective](https://github.com/user-attachments/assets/2e833091-9d0b-4570-9385-d56e7cbaa925)\n\n\n## Database Schema  \n\nThe project includes two tables:  \n\n![image](https://github.com/user-attachments/assets/68306a80-3f64-4ac6-ba3d-705db9bc7c88)\n\n# SQL Solutions\nThe SQL scripts in this repository cover:\n\nData Exploration: Understanding the structure and key statistics.\n\nRevenue Analysis: Identifying top-selling and most profitable items.\n\nOrder Trends: Analyzing peak ordering times and customer preferences.\n\nPerformance Insights: Evaluating order frequency and restaurant efficiency.\n\n# Key Findings:\nThe menu has 32 items across four categories: American, Asian, Mexican, and Italian.\n\nShrimp Scampi is the most expensive item, while Edamame is the least expensive.\n\nThe menu includes 9 Italian dishes, with Fettuccine Alfredo being the least expensive.\n\nA total of 5,370 orders were placed, with 12,234 items ordered within the dataset's date range.\n\nThe highest number of items in a single order was Order #4305.\n\nHamburger was the most ordered item, while Chicken Tacos was the least ordered.\n\nOrder #440 had the highest spending, mostly on Italian dishes, suggesting demand for more Italian options.\n\nThe top 5 highest-spending orders were from Order IDs: 440, 2075, 1957, 330, and 2675.\n\nThese insights help optimize menu offerings, identify customer preferences, and improve restaurant sales strategies.\n\n# Problems solved\n### -\u003e View the menu_items table and write a query to find the number of items on the menu\n```sql\nselect * from menu_items;\nselect count(*) from menu_items;\n```\n### -\u003e What are the price of least and most expensive items on the menu?\n```sql\nselect min(price) from menu_items;\nselect max(price) from menu_items;\n```\n### -\u003e How many Italian dishes are on the menu?\n```sql\nselect count(*) from menu_items \nwhere category = 'Italian';\n```\n### -\u003e What are the least and most expensive Italian dishes on the menu? Sort the table.\n```sql\nselect * from menu_items \nwhere category = 'Italian'\norder by price;\n\nselect * from menu_items \nwhere category = 'Italian'\norder by price desc;\n```\n### -\u003e  What are the items on the menu that have chicken in them.\n```sql\nselect * from menu_items \nwhere item_name like '%Chicken%';\n```\n### -\u003e How many dishes are in each category?\n```sql\nselect category , count(*) \nfrom menu_items\ngroup by 1;\n```\n### -\u003e What is the average dish price within each category?\n```sql\nselect category , avg(price) as avg_price\nfrom menu_items\ngroup by category;\n```\n\n### -\u003e View the order_details table.\n```sql\nselect * from order_details;\n```\n### -\u003e What is the date range of the table?\n```sql\nSELECT min(order_date) , max(order_date)\nfrom order_details;\n```\n### -\u003e How many orders were made within this date range?\n```sql\nSELECT count(distinct order_id) \nfrom order_details;\n```\n### -\u003e  How many items were ordered within this date range?\n```sql\nSELECT count(item_id) \nfrom order_details;\n```\n### -\u003e Which orders had the most number of items?\n```sql\nselect order_id , count(item_id) as item_count\nfrom order_details\nGROUP by order_id \norder by item_count desc;\n```\n### -\u003e How many orders had more than 12 items?\n```sql\nselect count(*) from  \n(select order_id , count(item_id) as item_count\nfrom order_details\nGROUP by order_id \nHAVING count(item_id) \u003e 12)  as num_orders;\n```\n### -\u003e Combine the menu_items and order_details tables into a single table\n```sql\nselect * from order_details \nleft join menu_items on order_details.item_id = menu_items.menu_item_id;\n```\n\n### -\u003e What were the least and most ordered items? What categories were they in?\n```sql\nselect category , item_name , count(item_id) from order_details \nleft join menu_items on order_details.item_id = menu_items.menu_item_id\nGROUP by 1,2\norder by 3 desc ;\n```\n### -\u003e What were the top 5 orders that spent the most money?\n```sql\nselect order_id , sum(price)\nfrom order_details \nleft join menu_items on order_details.item_id = menu_items.menu_item_id\nwhere price is not null\ngroup by 1\norder by 2 DESC\nlimit 5; \n```\n### -\u003e View the details of the highest spend order. Which specific items were purchased?\n```sql\nselect order_id , item_name, sum(price)\nfrom order_details \nleft join menu_items on order_details.item_id = menu_items.menu_item_id\nwhere price is not null\ngroup by 1 ,2\norder by 3 DESC\nlimit 1; \n```\n### -\u003e  how many categories have max price below 15$\n###  solved using SUBQUERY\n```sql\nselect count(*) from\n(\nselect category ,  max(price)  \nfrom menu_items\ngroup by 1\nhaving max(price) \u003c 15) as categories_having_max_price;\n```\n###  solved using CTE.\n```sql\nwith categories_having_max_price as (select category ,  max(price)  \nfrom menu_items\ngroup by 1\nhaving max(price) \u003c 15)\n\nselect count(*) from categories_having_max_price;\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshrunga92%2Frestaurant_order_analysis_sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshrunga92%2Frestaurant_order_analysis_sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshrunga92%2Frestaurant_order_analysis_sql/lists"}