Which aggregate function in SQL displays the number of values in the specified…

2025

Which aggregate function in SQL displays the number of values in the specified column ignoring the NULL values?

Answer: B. count ( )ConceptSQL aggregate functions reduce a set of rows into one summary value, and how many rows they cover depends on the argument passed to them:…

  1. A.

    len ( )

  2. B.

    count ( )

  3. C.

    number ( )

  4. D.

    num ( )

Attempted by 1545 students.

Show answer & explanation

Correct answer: B

Concept

SQL aggregate functions reduce a set of rows into one summary value, and how many rows they cover depends on the argument passed to them: COUNT(column_name) walks only the rows where that column holds a value, skipping any row where it is NULL, while COUNT(*) walks every row of the result set regardless of any column's NULL status.

Application

The question asks for the aggregate function that reports how many values a specified column holds while ignoring NULLs — that is precisely COUNT(column_name), written here as count(). Passing a column name to COUNT() applies exactly the NULL-skipping behaviour described above.

Cross-check

  • len() (LENGTH() in some dialects) measures the number of characters in one string value; it has no notion of rows or NULLs at all.

  • NUMBER names a numeric data type in dialects such as Oracle; it cannot be invoked as a function over a column's rows.

  • num() carries no defined meaning in SQL; it is not a built-in operation.

Clarifying the reported confusion

A frequently reported point of confusion is that COUNT(*) — a different call form — always includes rows with NULLs in its total, since it counts rows rather than a specific column's values. That fact is correct, but it describes COUNT(*), not COUNT(column_name). The two forms behave differently by design: COUNT(column_name) is the NULL-ignoring form asked about here, and count() remains the correct answer for a column-specific, NULL-ignoring count.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…