TGViewer
SQL Programming Resources SQL Programming Resources @sqlanalyst ยท 76.7K subscribers
Post #2610 3.17K
๐Ÿš€ SQL Project Series #13

Ride-Sharing Analytics ๐Ÿš–

Analyze trips, drivers, riders, earnings, cancellations, and customer behavior using SQL to improve operational efficiency and customer experience.

๐ŸŽฏ Business Objectives

โœ… Analyze trip demand

โœ… Track driver performance

โœ… Measure customer activity

โœ… Identify peak travel hours

โœ… Analyze cancellations

โœ… Monitor driver earnings

โœ… Calculate trip efficiency

โœ… Build operational dashboards

๐Ÿ“‚ Step 1: Create Database

CREATE DATABASE ride_sharing_db;
USE ride_sharing_db;


๐Ÿ“‚ Step 2: Create Riders Table

CREATE TABLE riders (
rider_id INT PRIMARY KEY,
rider_name VARCHAR(100),
city VARCHAR(50),
signup_date DATE
);


๐Ÿ“‚ Step 3: Create Drivers Table

CREATE TABLE drivers (
driver_id INT PRIMARY KEY,
driver_name VARCHAR(100),
vehicle_type VARCHAR(30),
city VARCHAR(50),
joining_date DATE
);


๐Ÿ“‚ Step 4: Create Trips Table

CREATE TABLE trips (
trip_id INT PRIMARY KEY,
rider_id INT,
driver_id INT,
trip_date TIMESTAMP,
pickup_location VARCHAR(100),
drop_location VARCHAR(100),
distance_km DECIMAL(6,2),
fare DECIMAL(10,2),
trip_status VARCHAR(20),
payment_method VARCHAR(20),
FOREIGN KEY (rider_id) REFERENCES riders(rider_id),
FOREIGN KEY (driver_id) REFERENCES drivers(driver_id)
);


๐Ÿ“‚ Step 5: Insert Sample Riders

INSERT INTO riders VALUES
(1,'Rahul','Mumbai','2024-01-10'),
(2,'Priya','Delhi','2024-02-15'),
(3,'Amit','Pune','2024-03-08'),
(4,'Sneha','Bangalore','2024-03-20'),
(5,'Rohan','Hyderabad','2024-04-01');


๐Ÿ“‚ Step 6: Insert Sample Drivers

INSERT INTO drivers VALUES
(101,'Arjun','Sedan','Mumbai','2023-05-10'),
(102,'Karan','SUV','Delhi','2023-07-18'),
(103,'Vijay','Bike','Pune','2023-08-25'),
(104,'Ramesh','Sedan','Bangalore','2023-10-12');


๐Ÿ“‚ Step 7: Insert Sample Trips

INSERT INTO trips VALUES
(1001,1,101,'2025-01-05 09:15:00','Andheri','Bandra',12.5,420,'Completed','UPI'),
(1002,2,102,'2025-01-05 18:30:00','Connaught Place','Noida',18.0,650,'Completed','Card'),
(1003,3,103,'2025-01-06 08:45:00','Hinjewadi','Shivajinagar',15.2,390,'Cancelled','Cash'),
(1004,4,104,'2025-01-06 20:10:00','Whitefield','MG Road',20.5,720,'Completed','UPI'),
(1005,5,101,'2025-01-07 14:20:00','Banjara Hills','Gachibowli',10.8,340,'Completed','Cash');


๐Ÿง  SQL Concepts You'll Practice

โœ” DDL & DML

โœ” Joins

โœ” Aggregate Functions

โœ” GROUP BY

โœ” HAVING

โœ” CASE WHEN

โœ” Window Functions

โœ” Common Table Expressions (CTEs)

โœ” Ranking Functions

โœ” Date & Time Functions

๐Ÿ“Š Business KPIs You Can Build

๐Ÿ“ˆ Total Trips

๐Ÿ“ˆ Completed Trips

๐Ÿ“ˆ Cancelled Trips

๐Ÿ“ˆ Cancellation Rate

๐Ÿ“ˆ Total Revenue

๐Ÿ“ˆ Average Trip Fare

๐Ÿ“ˆ Average Trip Distance

๐Ÿ“ˆ Revenue by City

๐Ÿ“ˆ Revenue by Driver

๐Ÿ“ˆ Driver Earnings

๐Ÿ“ˆ Trips per Driver

๐Ÿ“ˆ Most Active Riders

๐Ÿ“ˆ Rider Retention Rate

๐Ÿ“ˆ Peak Booking Hour

๐Ÿ“ˆ Peak Booking Day

๐Ÿ“ˆ Average Trip Duration

๐Ÿ“ˆ Payment Method Distribution

๐Ÿ“ˆ Revenue by Vehicle Type

๐Ÿ“ˆ Top Pickup Locations

๐Ÿ“ˆ Top Drop Locations

๐Ÿ“ˆ Highest Revenue Routes

๐Ÿ“ˆ Average Fare per Kilometer

๐Ÿ“ˆ Driver Utilization Rate

๐Ÿ“ˆ City-wise Demand Analysis

๐Ÿ“ˆ Executive Operations Dashboard

๐ŸŽฏ This project reflects real-world SQL analysis performed by Data Analysts, Operations Analysts, Growth Analysts, and Business Intelligence teams at companies like Uber, Ola, Lyft, and Rapido.

๐Ÿ’ก Double Tap โค๏ธ For More
  • โค 13
More from @sqlanalyst
  1. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  2. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  3. Oct 7, 2026SQL Interview Series โ€” Part 4 ๐Ÿ“Œ Question 4: Find the Highest Salary in Each Department Suโ€ฆ
  4. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
  5. Sep 29, 2026SQL Interview Series โ€” Part 2 ๐Ÿ“Œ Question 2: Find Duplicate Records Suppose you have an Emโ€ฆ
  6. Sep 29, 2026๐—™๐—ฅ๐—˜๐—˜ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—”๐—œ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ๐Ÿš€ โ€‹ Explore 6 free resourceโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’