Longest losing streaks

HardSupercellwindow functionsgaps and islands· 40 XP

Supercell's game designers worry that long losing streaks make players quit. They want to look at the players who had it worst.

For each player, find their longest run of consecutive losses (games ordered by played_at, then match_id). Show the 5 players with the longest losing streak, with their player_name.

Expected output

  • Longest streak first; break ties with the smaller player_id; exactly 5 rows

Example of the shape (made-up values):

player_id player_name longest_losing_streak
42 PixelFox42 9

Hints, the later steps and the answer come with Pro.

Write your query here. Ctrl + Enter submits.