#809

Show each player's team-best and team-worst

The daily_revenue table stores per-day revenue. The CFO wants every day shown next to the very first and very last revenue value across the whole reporting window — a handy baseline for "today vs. the earliest / latest day" comparisons. For each day return d, revenue, first_rev, last_rev — where first_rev is the earliest day's revenue in the set and last_rev is the latest day's. Order by d. Gotcha: the window function that returns the "last" value defaults to a frame that ends at the current row, so without explicitly extending the frame to the end of the partition it returns the current row's value instead of the actual last one.

Expected output sample

This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.

drevenuelast_revfirst_rev
2024-01-01100.00135.00100.00
2024-01-02120.00135.00100.00
2024-01-03110.00135.00100.00

Your query result will appear here