SQL SERVER TUTORIAL IN DEPTH

The blog is to help users about sql server

Others

LightBlog

Breaking

Wednesday, 10 December 2014

Distinct, AVG , COUNT how all behaves if null value exist in table

These are all basics but when asked in interview we make mistake.


select * from #temp












select AVG(id) from #temp  [5/3 or 5/5]







select COUNT(*) from #temp [5 or 3]







select distinct(id) from #temp [1,2 or 1,2,null]











No comments:

Post a Comment

 test