Skip to content
Question 60 of 95

Q.Which aggregate function in SQL displays the number of values in the specified column ignoring the NULL values ? (A) len() (B) count() (C) number() (D) num()

Tripura TbseCBSE Class XII Board 2025MCQ· 1mImportance★★★★★
63% · 60/95 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The COUNT() aggregate function in SQL is used to display the number of values in a specified column, inherently ignoring NULL values.

In SQL, aggregate functions are powerful tools designed to perform calculations on a set of rows and return a single summary value. These functions are fundamental for data analysis, allowing us to derive insights like sums, averages, maximums, minimums, and counts from large datasets. When dealing with real-world data, it's common to encounter NULL values, which represent missing or unknown data. How these NULL values are handled by aggregate functions is a crucial aspect of understanding their behavior.

The question specifically asks for an aggregate function that counts the number of values in a column while ignoring NULL entries. Among the standard SQL aggregate functions, COUNT() is precisely designed for this purpose.

Let's break down how COUNT() works:

  • COUNT(column_name): When you specify a column name inside the COUNT() function, like COUNT(EmployeeID) or COUNT(ProductName), SQL will iterate through each row in that column. For every row where the specified column_name has a non-NULL value, it increments the count. Rows where the column_name is NULL are simply skipped and do not contribute to the total count. This is the exact behavior requested by the question.

  • COUNT(*): It's important to distinguish COUNT(column_name) from COUNT(*). The COUNT(*) function counts the total number of rows in the result set, regardless of whether any specific column in those rows contains NULL values. It essentially counts the rows themselves, not the non-NULL values within a particular column.

Important

COUNT(column_name) counts only non-NULL values in the specified column, whereas COUNT(*) counts all rows, irrespective of NULLs in any column.

Now, let's consider the other options provided: …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.