Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Simple OVER()
8. OVER() – Review and Exercise 1
PARTITION BY
Ranking functions
Window Frames
Analytic Functions
PARTITION BY ORDER BY
Order of Evaluation
Finished!

Instruction

Great! We started our adventure in Part 2, where we introduced the basic concept of window functions. We started with a simple formula: AggregateFunction + OVER(). Take a look at the example:

SELECT
  Title,
  EditorRating,
  AVG(EditorRating) OVER()
FROM Movie;

This simple query will show each movie and, in the last column, the average EditorRating for all movies.

Exercise

For each gift card purchased, show the Id, the AmountWorth and the total number of all gift cards purchased. Name the last column TotalGiftCards.

Stuck? Here's a hint!

Use COUNT(Id) and do not put anything inside OVER().