The Waning Moon of Commerce

79. The Waning Moon of Commerce

Under certain moons, business dimmed, leaving Xorthax to endure the longest nights of quiet trade.

Xorthax is tracking business slowdowns. Find stretches of consecutive days where the total daily revenue from orders fell below 25,000. From those stretches, return the five longest, making sure ties in length are treated as equally ranked. Show the start date, end date, and streak length, ordered first by streak length and then by start date.
Write Your Query
Next Problem →
SQL Cookbook (O’Reilly)
SQL Cookbook (O’Reilly)

Practical SQL recipes for real-world querying—great complement to hands-on practice.

(Affiliate link – as an Amazon Associate I earn from qualifying purchases.)