On January 21th at 14:15 UTC , progression through exercises will be unavailable for 10 minutes due to a planned maintenance break.
Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Limiting the output
Eliminating duplicate results
13. Count the rows, ignore the NULLS
HAVING: filtering and ordering groups
Let's practice


Naturally, the asterisk (*) isn't the only argument you can pass in to the COUNT() function. For example, we may ask the database to count the values in a specific column:

  COUNT(CustomerId) AS CustomerNumber
FROM Order;

What's the difference between COUNT(*) and COUNT(CustomerId)? Well, the first option counts all rows in the table, and the second option counts all rows where the column CustomerId has a specified value. In other words, if there is a NULL in the CustomerId, it won't be counted.


Check how many non-NULL values in the column Position there are in the table Employee. Name the column PositionNumber.

Stuck? Here's a hint!


  COUNT(Position) AS PositionNumber
FROM Employee;