1,462 views
1 votes
1 votes

1)Count doesnot take NULL values, but Count(*) returns NULL values. Is it true?

The COUNT function can tell you the total number of rows returned in a result set (both NULL and non-NULL together depending on how it's used). For example: Using SELECT COUNT(*) or SELECT COUNT(1) (which is what I prefer to use) will return the total of all records returned in the result set regardless of NULL values

2)Other than Count what else return NULL values as part of calculation

3)Avg., sum,update these  are not take NULL take in calculation. right?

---------------------------------------------------------------------------------------------------------------

there are some contradictory statement here and here

1 Answer

Best answer
10 votes
10 votes
  • Count(*) ----> number of records in the table.

  • Count(A) ----> number of non null value over A.

  • Sum(A) ----> sum of non null value of attribute A.

  • Avg(A) ----> avg of non null value of attribute A.

 

 

selected by

Related questions

0 votes
0 votes
4 answers
2
ShiveshRoy asked Apr 1, 2016
2,136 views
What will COUNT(*) returns if all the collection has only null values???
0 votes
0 votes
0 answers
3
Tuhin Dutta asked Dec 15, 2017
410 views
Student tableROLLNONAMEMARKS1MARKS21T50302S70993DNULL10NULLNULL78NULLNULLNULLNULLNULLa) select count(MARKS1) from student;b) select count(*) from student;
0 votes
0 votes
1 answer
4
CKgurav asked Jan 1, 2016
1,257 views
How aggrigate functions in query will behave in data contains NULL values.I think answer should be D as all aggrigatre functions EXCEPT count will ignore NULL values. so,...