Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Get to know the data
Get to know the OVER() clause
Computations with OVER()
Aggregate functions with OVER()
9. OVER() and COUNT()
Using OVER() with WHERE
Summary

Instruction

Good job! OVER() works with all aggregate functions. Let's try an example with COUNT():

SELECT
  Id,
  Name,
  COUNT(Id) OVER() AS Count
FROM Department
ORDER BY Name ASC;

Here, we show the Id and Name of each department, plus the total number of all departments in the company. Lastly, we sort all the rows by name.

Exercise

For every employee that earns more than 4000, show their FirstName, LastName, Salary, and the total number of all employees (as EmployeeNumber).