Introduction
Simple OVER()
8. OVER() – Revision
PARTITION BY
Ranking functions
Window frame
Analytic functions
ORDER BY PARTITION BY
Order of evaluation
Summary

Instruction

Great. We started our adventure with window functions in part 2, where we introduced the basic concept of window functions with an aggregate function + OVER(). Take a look at the example:

SELECT
  title,
  editor_rating,
  AVG(editor_rating) OVER()
FROM movie;

This simple query will show each movie with the average editor_rating from all movies as the last column.

Exercise

Show each gift card purchased: id, amount_worth and the total number of all gift cards purchased.

Stuck? Here's a hint!

Simply use COUNT(id) and do not put anything inside OVER().

Console

Code editor

Result

TableConsole