Skip to content

Repository files navigation

Danny-s-Dinner-SQL-Case-Study

SQL case study solving customer purchasing behavior using MySQL, joins, CTEs, window functions and aggregation.

🍜 Danny's Dinner SQL Case Study

📖 Project Overview

This project contains the SQL solutions for the Danny's Dinner Case Study from the 8 Week SQL Challenge.

The objective of this case study is to analyze customer purchasing behavior, restaurant sales, and membership data using SQL queries.


🎯 Objectives

  • Analyze customer spending patterns
  • Find the most popular menu items
  • Calculate total revenue
  • Understand customer visits
  • Practice SQL using real business scenarios

🛠️ Tools & Technologies

  • MySQL
  • SQL
  • GitHub

📂 Database Tables

This case study contains three tables:

1. sales

Stores customer orders.

Column Description
customer_id Customer ID
order_date Date of purchase
product_id Purchased product

2. menu

Stores menu details.

Column Description
product_id Product ID
product_name Product Name
price Product Price

3. members

Stores membership information.

Column Description
customer_id Customer ID
join_date Membership Join Date

📌 SQL Concepts Used

  • SELECT
  • WHERE
  • GROUP BY
  • ORDER BY
  • INNER JOIN
  • LEFT JOIN
  • Aggregate Functions
  • CASE WHEN
  • CTE (Common Table Expressions)
  • Window Functions
  • RANK()
  • DENSE_RANK()
  • ROW_NUMBER()

✅ Business Questions Solved

  1. Total amount spent by each customer
  2. Number of days each customer visited
  3. First item purchased by each customer
  4. Most purchased item overall
  5. Most popular item for each customer
  6. First item purchased after becoming a member
  7. Item purchased just before becoming a member
  8. Total items and amount spent before membership
  9. Customer reward points
  10. Bonus reward points calculation

📁 Project Structure

Danny-s-Dinner-SQL-Case-Study/

├── README.md

├── Danny's_dinner_sql_casestudy.sql

└── screenshots/


📚 Learning Outcomes

Through this project, I learned:

  • SQL Joins
  • Aggregation Functions
  • Window Functions
  • Common Table Expressions (CTEs)
  • Customer Behavior Analysis
  • Business Problem Solving with SQL

👩‍💻 Author

Sonal Kumari

Aspiring Data Analyst


⭐ If you found this project useful, feel free to star this repository.

About

SQL case study solving customer purchasing behavior using MySQL, joins, CTEs, window functions and aggregation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors