What is the ouput of the following query,
SELECT COUNT(managerId) FROM Employee

empId Name managerId
789 select 45
356 update NULL
698 delete 78

 Posted by Kmandapalli on 2/4/2014 | Category: Sql Server Interview questions | Views: 1930 | Points: 40
Answer:

The output will be 2.
Because even though we have three rows but a single row does not contain managerId which means it contains NULL value.
Since the COUNT statement does not allow NULLS, the output is 2.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response