Instruction
Very good!
Now, it might be tempting to use window functions in a WHERE clause, as in the example:
SELECT first_name, last_name, salary, AVG(salary) OVER() FROM employee WHERE salary > AVG(salary) OVER();
However, when you run this query, you'll get an error message. You cannot put window functions in WHERE. Why? The window functions is applied after the rows are selected. If the window functions were in a WHERE clause, you'd get a circular dependency: in order to compute the window function, you have to filter the rows with WHERE, which requires to compute the window function.
Exercise
Run the template to see the error message.
Then press .



