2024 Teammate Head-to-Heads

Hard · Formula 1 · Tables: results, races, drivers

Count how often each driver ranked ahead of a teammate in 2024 Grand Prix results. Compare distinct drivers with the same raceId and constructorId. Keep comparisons only when both drivers have a non-NULL numeric final position from 1 through 20; the driver with the smaller numeric position wins that comparison. Return integer driver_id, full driver name as driver, and numeric teammate_wins. Include only drivers who win at least one comparison. Order by teammate_wins descending, then driver_id ascending. Count result-row pairs: if a driver had different teammates during the year, all eligible comparisons count. Exclude sprints and unclassified results.

More SQL practice problems