home
diamond Go Premium
Data Engineering Path  ·  Data Modelling
UBER & RIDE-SHARING CASE STUDY

Step 5: SQL Queries & Use Cases (Uber)

Banner

1. Calculate Monthly Earnings for a Driver

Retrieves completed trips and tallies up payments:

SELECT d.driver_id, d.first_name, d.last_name,
       SUM(p.amount) AS total_earnings,
       COUNT(t.trip_id) AS total_trips
FROM drivers d
JOIN trips t ON d.driver_id = t.driver_id
JOIN payments p ON t.trip_id = p.trip_id
WHERE t.status = 'completed' 
  AND p.status = 'completed'
  AND t.requested_at >= '2026-05-01'
GROUP BY d.driver_id;

2. Find High-Rating In-Progress Rides

SELECT t.trip_id, r.first_name AS rider_name, d.first_name AS driver_name
FROM trips t
JOIN riders r ON t.rider_id = r.rider_id
JOIN drivers d ON t.driver_id = d.driver_id
WHERE t.status = 'in_progress' AND d.rating >= 4.8;
lock

This content is reserved for Premium Members.

Upgrade to Premium

Entity Details

Create New Item

help

Submit Technical Query

Have a question or run into an issue? Describe it below, upload an optional screenshot, and our engineering team will answer it!

image Attach image (optional)

Submit Feedback

build Free Developer Utility Free Tool
gavel

Privacy & Legal Disclaimer

1. Client-Side Browser Processing

All utility tools on DeepEngineerHub (including Image to PDF, Text Formatters, JSON Converters, and Encryptors) execute 100% locally within your client browser using WebAssembly and JavaScript. No uploaded images, text, or documents are transmitted, collected, or stored on remote servers.

2. Limitation of Liability ("As-Is" Provision)

Tools and services are provided free of charge for convenience and educational purposes "as-is" without warranties of any kind. DeepEngineerHub shall not be held liable for any data loss, formatting inconsistencies, or indirect damages resulting from tool usage.

3. Open Source & Third-Party Software

Certain utilities utilize open-source client libraries (such as jsPDF, Mermaid.js, Pyodide) licensed under MIT, Apache, or BSD open licenses. All intellectual property remains with their respective copyright holders.