Rental Revenue per Car
Medium
Car Rental Operations
Each rental is charged per day, counting both the start and end dates. Return each car model and its total revenue, including 0 for cars never rented. Order by model.
Table schema
Cars(car_id INT PRIMARY KEY, model VARCHAR(20), daily_rate INT)
Rentals(rental_id INT PRIMARY KEY, car_id INT, customer VARCHAR(20), start_date DATE, end_date DATE)Sample data
Cars
car_id | model | daily_rate
1 | Swift | 30
2 | Creta | 50
3 | Innova | 70
Rentals
rental_id | car_id | customer | start_date | end_date
1 | 1 | Ravi | 2026-03-01 | 2026-03-03
2 | 1 | Sana | 2026-03-02 | 2026-03-05
3 | 2 | Ravi | 2026-03-08 | 2026-03-12
4 | 2 | Tej | 2026-03-13 | 2026-03-14
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.