Quick Summary
- Calculate efficiency as total miles divided by total energy use per vehicle model.
- Aggregate trip and maintenance data separately per vehicle to prevent row duplication.
- Filter models by maintenance cost limits and energy usage, returning the top 5 ranked by efficiency.
What This Tests
- Pre-aggregation to resolve Many-to-Many fan-out issues between fact tables.
- Multi-step aggregation involving vehicle-level summaries and model-level rollups.
- Handling optional relationships with Left Joins and null-safe arithmetic.
- Ordering, filtering, and limiting result sets based on computed metrics.
Common Patterns
Aggregation
Left Join
Multiple Joins
Groupby
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
-
Output
-
Expected
-