Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Default window frame
20. Default window frame – with ORDER BY


Good job! When there is no ORDER BY clause in OVER(...), the query simply treats all rows as the window frame for each row. Nothing shocking, really – that's the type of query we wrote previously.

Remember that we said if there is an ORDER BY clause, RANGE UNBOUNDED PRECEDING will be used as the default window frame? Let's find out if that's true.


Once again, we'll be looking for the running sum of single orders. For each order, show its Id, PlacedDate, TotalPrice and the sum of all total prices. Sort the orders by PlacedDate, but do not specify any window frame.

The sum of TotalPrices should be calculated as if you wrote RANGE UNBOUNDED PRECEDING.

Name the last column SumTotalPrice.

Stuck? Here's a hint!

Use SUM(TotalPrice) OVER(ORDER BY PlacedDate ASC).