ExpertAnalytics Patterns50 points

Hot streaks: each club's longest run of wins

A broadcaster wants a graphic on momentum: for every club, the longest run of consecutive league wins in 2025-26 (home and away games together, in date order). Each club plays exactly once per matchweek, so match_date is unique per club. A draw or a defeat breaks a run. Clubs that never won a game have no streak and must not appear.

If a club has two runs of the same longest length, report the earlier one (the one with the smaller start date).

Task: return club (name), longest_win_streak (number of games), start_date and end_date (dates of the first and last win of that run). Sort by longest_win_streak from high to low, then start_date ascending, then club A to Z.

The data you can query

Each table is shown with its column types and the first rows, so you can see exactly what the data looks like.

clubs10 rows
club_id INTEGERname TEXTcity TEXTstadium_capacity INTEGER
1Harbor City FCHarbor City48000
2Rivermoor UnitedRivermoor36000
3Atlas AthleticPort Atlas41000
4Solent AlbionSolent Bay29000
5Kestrel TownKestrel22000
6Ironbridge WanderersIronbridge33000

Showing the first 6 of 10 rows.

goals222 rows
goal_id INTEGERmatch_id INTEGERplayer_id INTEGERclub_id INTEGERminute INTEGER
112153
215166
3262932
4214277
5321359
6321365

Showing the first 6 of 222 rows.

matches90 rows
match_id INTEGERseason TEXTmatchweek INTEGERmatch_date TEXThome_club_id INTEGERaway_club_id INTEGERhome_goals INTEGERaway_goals INTEGER
12025-2612025-08-0911020
22025-2612025-08-092911
32025-2612025-08-093822
42025-2612025-08-094723
52025-2612025-08-095631
62025-2622025-08-239100

Showing the first 6 of 90 rows.

players70 rows
player_id INTEGERname TEXTclub_id INTEGERposition TEXTnationality TEXTbirth_date TEXT
1Oliver Hughes1GKUnited Kingdom1996-02-16
2Mateusz Nowak1DFPoland2003-12-02
3Caleb Brooks1DFUnited States2000-06-16
4Nour Salem1MFEgypt2006-02-25
5Kofi Owusu1MFGhana1994-08-02
6Ethan Hayes8FWUnited States1995-10-27

Showing the first 6 of 70 rows.

transfers26 rows
transfer_id INTEGERplayer_id INTEGERfrom_club TEXTto_club_id INTEGERtransfer_date TEXTfee_musd REAL
12Dunmore Athletic12024-10-012.5
25Santa Rosa SC12024-11-058
38FC Lindenberg22025-07-1118
411Real Costa Verde22025-04-180
514Nordhavn IF22025-02-074
617Olympia Kallithea32024-09-1015

Showing the first 6 of 26 rows.

Your query runs on SQLite. Write a single SELECT; use LIMIT instead of TOP.

Need a hint?

Gaps and islands: subtract the row number within wins from the row number overall. Consecutive wins share the same difference.