Now, it might be tempting to use window functions inside the
WHERE clause, as shown below:
AVG(Salary) OVER() AS AvgSalary
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 function is applied after the rows are selected. If the window functions are in a
WHERE clause, you get a circular dependency: in order to compute the window function, you have to filter the rows with
WHERE, which requires the computation of the window function.