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) returns the number of unique, non-null values for the specified expression. It eliminates both NULL values and duplicate values from the count, giving the count of distinct values present.

AI explanation

COUNT(DISTINCT expr) counts the number of unique, non-null values that the expression takes across the rows considered — duplicate values are counted once, and rows where the expression is null are excluded entirely. This differs from plain COUNT(expr), which counts all non-null occurrences including duplicates.