Multiple choice technology databases

COUNT(DISTINCT expr) returns

  1. No. of rows in a table

  2. No. of rows with non-null values of the expr

  3. No. of distinct non-null values of the expr

  4. None of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

COUNT(DISTINCT expr) counts the number of unique, non-null values in the specified expression. NULL values are ignored, and duplicate values are counted only once. This is different from regular COUNT(*) which counts all rows including NULLs in some contexts.