Danny’s Diner
Data exploration using mySQL
Published in
3 min readFeb 4, 2023
This is a guided case study where I use SQL skills to answer the first part of 8 week SQL challenge posted by Danny Ma.
This case study is based on a restaurant, you can find it here and try it yourself. My solution is also hosted on my Git Hub and you can access it here.
SQL skills that I honed while doing the case study
- JOINS
- ALIASES — used more frequently as I practised
- WINDOW FUNCTION — Rank
- CTE (Common Table Expressions)
- CASE STATEMENTS
Question 1 — What is the total amount each customer spent at the restaurant?
Question 2 — How many days has each customer visited the restaurant?
Question 3 - What was the first item from the menu purchased by each customer?
Question 4 — What is the most purchased item on the menu
and how many times was it purchased by all customers?
Question 5 — Which item was the most popular for each customer?
Question 6 — Which item was purchased first by the customer after they became a member?
Question 7 — Which item was purchased just before the customer became a member?
Question 8 — What is the total items and amount spent for each member before they became a member?
Question 9 - if each $1 spent equates to 10 points and sushi has a 2x points multiplier — how many points would each customer have?
Question 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 A and B have at the end of January?
Bonus question 1 — Join All The Things
Bonus Question 2 — Rank All The Things
Thank you for reading! Let me if you have any queries about my solutions!