218k views
4 votes
Does the count aggregate function count NULL values when counting the number of elements in a column (attribute)?

a) Yes
b) No

User Berenbums
by
8.4k points

1 Answer

3 votes

Final answer:

The COUNT aggregate function does not include NULL values when counting elements in a column; it counts only the non-null values. COUNT(*) can be used to count all rows, including those with NULL values.

Step-by-step explanation:

The COUNT aggregate function in SQL does not count NULL values when counting the number of elements in a column. Instead, the function will only count rows where the column has a non-null value. To count all rows regardless of null values, you can use COUNT(*), which counts every row in the specified table or view.

User Adir Dayan
by
7.5k points