https://github.com/hellymodikalpesh/sql-project-zomato-data-analysis
This project showcases my SQL expertise through a comprehensive analysis of Zomato's food delivery business. From database creation to solving complex business problems, this project highlights my ability to extract actionable insights using SQL.
https://github.com/hellymodikalpesh/sql-project-zomato-data-analysis
sql
Last synced: 4 months ago
JSON representation
This project showcases my SQL expertise through a comprehensive analysis of Zomato's food delivery business. From database creation to solving complex business problems, this project highlights my ability to extract actionable insights using SQL.
- Host: GitHub
- URL: https://github.com/hellymodikalpesh/sql-project-zomato-data-analysis
- Owner: HellyModiKalpesh
- Created: 2024-12-18T09:16:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-18T09:46:19.000Z (over 1 year ago)
- Last Synced: 2025-08-30T17:48:55.499Z (10 months ago)
- Topics: sql
- Homepage:
- Size: 544 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SQL-Project-Zomato-Data-Analysis
This project showcases my SQL expertise through a comprehensive analysis of Zomato's food delivery business. From database creation to solving complex business problems, this project highlights my ability to extract actionable insights using SQL.

## Project Structure
- **Database Setup:** Creation of the `zomato_db` database and the required tables.
- **Data Import:** Inserting sample data into the tables.
- **Data Cleaning:** Handling null values and ensuring data integrity.
- **Business Problems:** Solving 20 specific business problems using SQL queries.
## Tables
- **restaurants**: Information about restaurants (e.g., name, city, opening hours).
- **customers**: Details of registered customers.
- **riders**: Information about riders and sign-up dates.
- **orders**: Tracks orders placed by customers, including status and amount.
- **deliveries**: Delivery details, including rider and status.
## Database Setup
```sql
CREATE DATABASE zomato_db;
```
### 1. Dropping Existing Tables
```sql
DROP TABLE IF EXISTS deliveries;
DROP TABLE IF EXISTS Orders;
DROP TABLE IF EXISTS customers;
DROP TABLE IF EXISTS restaurants;
DROP TABLE IF EXISTS riders;
-- 2. Creating Tables
CREATE TABLE restaurants (
restaurant_id SERIAL PRIMARY KEY,
restaurant_name VARCHAR(100) NOT NULL,
city VARCHAR(50),
opening_hours VARCHAR(50)
);
CREATE TABLE customers (
customer_id SERIAL PRIMARY KEY,
customer_name VARCHAR(100) NOT NULL,
reg_date DATE
);
CREATE TABLE riders (
rider_id SERIAL PRIMARY KEY,
rider_name VARCHAR(100) NOT NULL,
sign_up DATE
);
CREATE TABLE Orders (
order_id SERIAL PRIMARY KEY,
customer_id INT,
restaurant_id INT,
order_item VARCHAR(255),
order_date DATE NOT NULL,
order_time TIME NOT NULL,
order_status VARCHAR(20) DEFAULT 'Pending',
total_amount DECIMAL(10, 2) NOT NULL,
FOREIGN KEY (customer_id) REFERENCES customers(customer_id),
FOREIGN KEY (restaurant_id) REFERENCES restaurants(restaurant_id)
);
CREATE TABLE deliveries (
delivery_id SERIAL PRIMARY KEY,
order_id INT,
delivery_status VARCHAR(20) DEFAULT 'Pending',
delivery_time TIME,
rider_id INT,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (rider_id) REFERENCES riders(rider_id)
);
```
## Data Cleaning and Handling Null Values
Before performing analysis, I ensured that the data was clean and free from null values where necessary. For instance:
```sql
UPDATE orders
SET total_amount = COALESCE(total_amount, 0);
```
## Business Problems Solved
### 1. Write a query to find the top 5 most frequently ordered dishes by customer called "Arjun Mehta" in the last 1 year.
### 2. Popular Time Slots
-- Question: Identify the time slots during which the most orders are placed. based on 2-hour intervals.
### 3. Order Value Analysis
-- Question: Find the average order value per customer who has placed more than 750 orders.
-- Return customer_name, and aov(average order value)
### 4. High-Value Customers
-- Question: List the customers who have spent more than 100K in total on food orders.
-- return customer_name, and customer_id!
### 5. Orders Without Delivery
-- Question: Write a query to find orders that were placed but not delivered.
-- Return each restuarant name, city and number of not delivered orders
### 6. Restaurant Revenue Ranking:
-- Rank restaurants by their total revenue from the last year, including their name,
-- total revenue, and rank within their city.
### 7. Most Popular Dish by City:
-- Identify the most popular dish in each city based on the number of orders.
### 8. Customer Churn:
-- Find customers who haven’t placed an order in 2024 but did in 2023.
### 9. Cancellation Rate Comparison:
-- Calculate and compare the order cancellation rate for each restaurant between the
-- current year and the previous year.
### 10. Rider Average Delivery Time:
-- Determine each rider's average delivery time.
### 11. Monthly Restaurant Growth Ratio:
-- Calculate each restaurant's growth ratio based on the total number of delivered orders since its joining
### 12. Customer Segmentation:
-- Customer Segmentation: Segment customers into 'Gold' or 'Silver' groups based on their total spending
-- compared to the average order value (AOV). If a customer's total spending exceeds the AOV,
-- label them as 'Gold'; otherwise, label them as 'Silver'. Write an SQL query to determine each segment's
-- total number of orders and total revenue
### 13. Rider Monthly Earnings:
-- Calculate each rider's total monthly earnings, assuming they earn 8% of the order amount.
### Q.14 Rider Ratings Analysis:
-- Find the number of 5-star, 4-star, and 3-star ratings each rider has.
-- riders receive this rating based on delivery time.
-- If orders are delivered less than 15 minutes of order received time the rider get 5 star rating,
-- if they deliver 15 and 20 minute they get 4 star rating
-- if they deliver after 20 minute they get 3 star rating.
### 15. Q.15 Order Frequency by Day:
-- Analyze order frequency per day of the week and identify the peak day for each restaurant.
### 16. Customer Lifetime Value (CLV):
-- Calculate the total revenue generated by each customer over all their orders.
### 17. Monthly Sales Trends:
-- Identify sales trends by comparing each month's total sales to the previous month
### 18. Rider Efficiency:
-- Evaluate rider efficiency by determining average delivery times and identifying those with the lowest and highest averages.
### 19. Order Item Popularity:
-- Track the popularity of specific order items over time and identify seasonal demand spikes.
### 20. Rank each city based on the total revenue for last year 2023
## Conclusion
This project highlights my ability to handle complex SQL queries and provides solutions to real-world business problems in the context of a food delivery service like Zomato. The approach taken here demonstrates a structured problem-solving methodology, data manipulation skills, and the ability to derive actionable insights from data.
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.

