This project focuses on analyzing interconnected restaurant and consumer datasets using a relational MySQL database and SQL.
The project transforms raw CSV datasets into structured relational tables and applies SQL techniques such as filtering, joins, subqueries, aggregation, Common Table Expressions (CTEs), derived tables, window functions, views, and stored procedures.
The analysis explores consumer demographics, cuisine preferences, restaurant characteristics, locations, and rating patterns.
To organize and analyze interconnected restaurant and consumer datasets using a relational MySQL database and SQL in order to extract meaningful, data-supported insights about consumer behavior, preferences, restaurants, cuisines, locations, and ratings.
The project uses five related datasets:
consumers— Consumer demographic and lifestyle informationconsumer_preferences— Preferred cuisines of consumersrestaurants— Restaurant details and characteristicsrestaurant_cuisines— Cuisines offered by restaurantsratings— Consumer ratings for restaurants
- MySQL
- SQL
- Relational Database Design
- Data Cleaning
- Data Validation
- Filtering & Conditional Queries
- JOINs
- Subqueries
- Aggregation & GROUP BY
- HAVING
- Common Table Expressions (CTEs)
- Derived Tables
- Window Functions
- Views
- Stored Procedures
The datasets are connected through primary and foreign key relationships.
The main relationships include:
consumers→consumer_preferencesrestaurants→restaurant_cuisinesconsumers→ratingsrestaurants→ratings
The ratings table connects consumers with restaurants and supports analysis of consumer-rating behavior.
The project contains SQL analysis covering:
- Consumers by city
- Students who smoke
- Restaurants based on alcohol service and price
- Franchise restaurants
- Ratings based on overall rating
- Restaurants receiving high ratings
- Consumers rating restaurants in specific cities
- Cuisine-specific restaurant analysis
- Consumer cuisine preferences and budgets
- Ratings compared with overall averages
- Consumer and restaurant relationship analysis
- Number of restaurants rated by consumers
- Consumer engagement scoring
- Average restaurant ratings
- Rating comparisons
- Consumer and restaurant performance analysis
- Common Table Expressions (CTEs)
- Derived tables
- Window functions
RANK()DENSE_RANK()ROW_NUMBER()LEAD()- Views
- Stored Procedures
- Multi-level analytical queries
During data preparation, duplicate records were identified in the consumer_preferences dataset.
Duplicate (Consumer_ID, Preferred_Cuisine) records were removed before loading the cleaned dataset.
The final datasets were also checked for:
- Primary key consistency
- Foreign key relationships
- Duplicate rating pairs
- Referential integrity between related tables
Some of the analysis results include:
- 22 consumers are located in Cuernavaca.
- 23 consumers are students and smokers.
- 15 restaurants provide Wine & Beer service and have a Medium price level.
- 22 restaurants are franchises.
- 486 ratings have an Overall Rating of 2.
- 117 restaurants received at least one Overall Rating of 2.
- 92 consumers rated restaurants in San Luis Potosi.
- 125 restaurants had at least one Food Rating below the global average.
- 42 top-ranked restaurant/cuisine results were identified using
DENSE_RANK()with ties.
Restaurant_consumer_sql_analysis/
│
├── README.md
│
├── SQL/
│ └── restaurant_consumer_analysis.sql
│
├── Data/
│ ├── consumers.csv
│ ├── consumer_preferences_cleaned.csv
│ ├── restaurants.csv
│ ├── restaurant_cuisines.csv
│ └── ratings.csv
│
├── ER_Diagram/
│ └── restaurant_consumer_er_diagram.png
│
├── Presentation/
│ └── Yaswanth_Restaurant_Consumer_SQL_Project_Presentation.pptx