How to count NULL values in SQL?
as mentioned in the above title this also another tricky SQL query as well. We were talking about How to count unique value in any column in SQL in the previous article. We are going to talk about another topic is same like as previous article but a little bit different. So without further ado let’s get started.
Suppose we have a table EMPLOYEE as the following picture:
So as we know when we counting record in SQL NULL values not counting, but sometimes we want to know that how many record keeping null values in any column in SQL aren’t we? So without any further ado let’s get started.
Write query like this and see the results like that:
SELECT COUNT(*)
FROM emp
WHERE mgr is null;
after that when query occur you are be able to see that result will be 1 because our MGR column only one record can contain null value.