Get to know the data
Get to know the OVER() clause
Computations with OVER()
Aggregate functions with OVER()
Using OVER() with WHERE
13. Using OVER() with WHERE
Summary

## Instruction

Very good!

Now, it might be tempting to use window functions inside the WHERE clause, as shown below:

SELECT
FirstName,
LastName,
Salary,
AVG(Salary) OVER() AS AvgSalary
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 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.

## Exercise

Run the template to see the error message.

Then click .