{"id":15003289,"url":"https://github.com/kleamertiri/8-week-sql-challenge","last_synced_at":"2026-03-14T23:35:41.665Z","repository":{"id":154711137,"uuid":"623849368","full_name":"kleamertiri/8-Week-SQL-Challenge","owner":"kleamertiri","description":"Use cases solutions for #8_Week_SQL_Challenge from #DataWithDanny","archived":false,"fork":false,"pushed_at":"2023-08-24T09:38:42.000Z","size":187,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T14:21:55.672Z","etag":null,"topics":["ms-sql-server","sql"],"latest_commit_sha":null,"homepage":"https://8weeksqlchallenge.com/","language":"TSQL","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/kleamertiri.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":"2023-04-05T08:11:11.000Z","updated_at":"2023-07-18T09:25:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b76e81a-948c-494c-8099-e64a091b4929","html_url":"https://github.com/kleamertiri/8-Week-SQL-Challenge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleamertiri%2F8-Week-SQL-Challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleamertiri%2F8-Week-SQL-Challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleamertiri%2F8-Week-SQL-Challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kleamertiri%2F8-Week-SQL-Challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kleamertiri","download_url":"https://codeload.github.com/kleamertiri/8-Week-SQL-Challenge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243154728,"owners_count":20244984,"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":["ms-sql-server","sql"],"created_at":"2024-09-24T18:57:52.737Z","updated_at":"2025-12-26T00:14:19.632Z","avatar_url":"https://github.com/kleamertiri.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :oil_drum: 8 Week SQL Challenge\nIn this repository I will display the solutions for 8 use cases in [8 Week SQL Challenge](https://8weeksqlchallenge.com/) from @DataWithDanny\n\n## :arrow_forward: List of Challenges \n- [Case Study #1 - Danny's Diner](#case-study-1---dannys-diner)\n- [Case Study #2 - Pizza Runner](#case-study-2---pizza-runner)\n- [Case Study #3 - Foodie-Fi](#case-study-3---foodie-fi)\n## Case Study #1 - Danny's Diner\n\n:zap: [SQL Syntax \u0026 Solutions](https://github.com/kleamertiri/8-Week-SQL-Challenge/tree/main/%231%20-%20Danny's%20Diner)\n\n  \n[![Capture](https://user-images.githubusercontent.com/105167291/230071791-2aef7e3b-095e-4a11-a628-ad1188a868ad.PNG)](https://8weeksqlchallenge.com/case-study-1/)\n### Problem Statement\nDanny wants to use the data to answer a few simple questions about his customers:\n- About their visiting patterns\n- How much money they’ve spent?\n- Which menu items are their favourite?\n\n### Entity Relationship Diagram\n![image](https://user-images.githubusercontent.com/105167291/230072841-434767eb-10ad-439d-a9b0-7f9cdae5fefb.png)\n### Case Study Questions\n\u003cdetails\u003e\n  \u003csummary\u003eClick here\u003c/summary\u003e\n  \n  1. What is the total amount each customer spent at the restaurant?\n  2.  How many days has each customer visited the restaurant?\n  3.  What was the first item from the menu purchased by each customer?\n  4.  What is the most purchased item on the menu and how many times was it purchased by all customers?\n  5.  Which item was the most popular for each customer?\n  6.  Which item was purchased first by the customer after they became a member?\n  7.  Which item was purchased just before the customer became a member?\n  8.  What is the total items and amount spent for each member before they became a member?\n  9.  If each $1 spent equates to 10 points and sushi has a 2x points multiplier - how many points would each customer have?\n  10.  In the first week after a customer joins the program (including their join date) they earn 2x points on all items, not just sushi - how many points do customer\n        A and B have at the end of January?\n  ##### Bonus Questions\n  1. Join the tables and create a new column to find out if a customer is a member, and during what time the customer became a member.\n  2. Danny also requires further information about the ranking of customer products, but he purposely does not need the ranking for non-member purchases so he expects      null ranking values for the records when customers are not yet part of the loyalty program\n  \n\u003c/details\u003e\n\n## Case Study #2 - Pizza Runner\n:zap: [SQL Syntax \u0026 Solutions](https://github.com/kleamertiri/8-Week-SQL-Challenge/tree/main/%232%20-%20Pizza%20Runner)\n\n[![2](https://user-images.githubusercontent.com/105167291/230781392-def52ec2-35b5-482d-b4bd-1cbd745e6fbc.png)](https://8weeksqlchallenge.com/case-study-2/)\n\n### Introduction\nDanny was scrolling through his Instagram feed when something really caught his eye - “80s Retro Styling and Pizza Is The Future!”\n\nDanny was sold on the idea, but he knew that pizza alone was not going to help him get seed funding to expand his new Pizza Empire - so he had one more genius idea to combine with it - he was going to Uberize it - and so Pizza Runner was launched!\n\n### Entity Relationship Diagram\n![Capture](https://user-images.githubusercontent.com/105167291/230781641-e3f42a47-d8de-4e6d-a642-83eddc64882f.PNG)\n\n### Case Study Questions \nThis case study has **LOTS** of questions - they are broken up by area of focus including:\n\n\u003cdetails\u003e\n  \u003csummary\u003eA. Pizza Metrics\u003c/summary\u003e\n  \n  1. How many pizzas were ordered?\n  2. How many unique customer orders were made?\n  3. How many successful orders were delivered by each runner?\n  4. How many of each type of pizza was delivered?\n  5. How many Vegetarian and Meatlovers were ordered by each customer?\n  6. What was the maximum number of pizzas delivered in a single order?\n  7. For each customer, how many delivered pizzas had at least 1 change and how many had no changes?\n  8. How many pizzas were delivered that had both exclusions and extras?\n  9. What was the total volume of pizzas ordered for each hour of the day?\n  10. What was the volume of orders for each day of the week?\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eB. Runner and Customer Experience\u003c/summary\u003e\n  \n1. How many runners signed up for each 1 week period? (i.e. week starts 2021-01-01)\n2. What was the average time in minutes it took for each runner to arrive at the Pizza Runner HQ to pickup the order?\n3. Is there any relationship between the number of pizzas and how long the order takes to prepare?\n4. What was the average distance travelled for each customer?\n5. What was the difference between the longest and shortest delivery times for all orders?\n6. What was the average speed for each runner for each delivery and do you notice any trend for these values?\n7. What is the successful delivery percentage for each runner?\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eC. Ingredient Optimisation\u003c/summary\u003e\n\n1. What are the standard ingredients for each pizza?\n2. What was the most commonly added extra?\n3. What was the most common exclusion?\n4. Generate an order item for each record in the customers_orders table in the format of one of the following:\n   - Meat Lovers\n   - Meat Lovers - Exclude Beef\n   - Meat Lovers - Extra Bacon\n   - Meat Lovers - Exclude Cheese, Bacon - Extra Mushroom, Peppers\n5.  Generate an alphabetically ordered comma separated ingredient list for each pizza order from the customer_orders table and add a 2x in front of any relevant ingredients\n6.  What is the total quantity of each ingredient used in all delivered pizzas sorted by most frequent first?\n\u003c/details\u003e\n\n## Case Study #3 - Foodie-Fi\n\n:zap: [SQL Syntax \u0026 Solutions](https://github.com/kleamertiri/8-Week-SQL-Challenge/tree/main/%233%20-%20Foodie-Fi)\n\n[![3](https://github.com/kleamertiri/8-Week-SQL-Challenge/assets/105167291/fdd7d8aa-a663-4e6d-9b0b-6409998084f1)](https://8weeksqlchallenge.com/case-study-3/)\n\n### Introduction\n\nSubscription based businesses are super popular and Danny realised that there was a large gap in the market - he wanted to create a new streaming service that only had food related content - something like Netflix but with only cooking shows!\n\nDanny finds a few smart friends to launch his new startup Foodie-Fi in 2020 and started selling monthly and annual subscriptions, giving their customers unlimited on-demand access to exclusive food videos from around the world!\n\nDanny created Foodie-Fi with a data driven mindset and wanted to ensure all future investment decisions and new features were decided using data. This case study focuses on using subscription style digital data to answer important business questions.\n\n### Entity Relationship Diagram\n\n![image](https://github.com/kleamertiri/8-Week-SQL-Challenge/assets/105167291/b96ccbeb-49b1-4347-8775-988d220cb08e)\n\n### Case Study Questions\n\nThis case study is split into an initial data understanding question before diving straight into data analysis questions before finishing with 1 single extension challenge.\n\n\u003cdetails\u003e\n  \u003csummary\u003eA. Customer Journey\u003c/summary\u003e\n  Based off the 8 sample customers provided in the sample from the subscriptions table, write a brief description about each customer’s onboarding journey.\n  Try to keep it as short as possible - you may also want to run some sort of join to make your explanations a bit easier!\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eB. Data Analysis Questions\u003c/summary\u003e\n  \n  1. How many customers has Foodie-Fi ever had?\n  2. What is the monthly distribution of trial plan start_date values for our dataset - use the start of the month as the group by value\n  3. What plan start_date values occur after the year 2020 for our dataset? Show the breakdown by count of events for each plan_name\n  4. What is the customer count and percentage of customers who have churned rounded to 1 decimal place?\n  5. How many customers have churned straight after their initial free trial - what percentage is this rounded to the nearest whole number?\n  6. What is the number and percentage of customer plans after their initial free trial?\n  7. What is the customer count and percentage breakdown of all 5 plan_name values at 2020-12-31?\n  8. How many customers have upgraded to an annual plan in 2020?\n  9. How many days on average does it take for a customer to an annual plan from the day they join Foodie-Fi?\n  10. Can you further breakdown this average value into 30 day periods (i.e. 0-30 days, 31-60 days etc)\n  11. How many customers downgraded from a pro monthly to a basic monthly plan in 2020?\n  \n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkleamertiri%2F8-week-sql-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkleamertiri%2F8-week-sql-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkleamertiri%2F8-week-sql-challenge/lists"}