Question:

Assertion (A): The output of the SQL query SELECT COUNT (name) FROM students; will differ from the output of SELECT COUNT (*) FROM students; if there are some NULL values in the name column.

Reason (R): COUNT(column_name) returns the count of NON NULL values in that column, whereas COUNT(*) returns the number of records in the table.

Show Hint

COUNT(column) skips NULL values while COUNT(*) counts all rows. This is why the two outputs differ.
Updated On: Oct 20, 2026
  • Both (A) and (R) are True, and (R) correctly explains (A).
  • Both (A) and (R) are True, but (R) does not correctly explain (A).
  • (A) is True, but (R) is False.
  • (A) is False, but (R) is True.
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Understand the question type:
We have an Assertion (A) and a Reason (R). We check if each is true and whether R explains A.

Step 2: Recall how COUNT works:
COUNT(column_name) counts only the rows where that column is NOT NULL.
COUNT(*) counts every row of the table, whether a column holds NULL or not.

Step 3: Check the Reason (R):
R says COUNT(column_name) counts non-NULL values and COUNT(*) counts the records. This is exactly the rule above. So (R) is True.

Step 4: Check the Assertion (A):
Take a table with 5 students where 2 names are NULL.
COUNT(name) gives 3. COUNT(*) gives 5.
So the two outputs differ when name has NULL values. (A) is True.

Step 5: Does R explain A?
The outputs differ because COUNT(name) skips NULL names while COUNT(*) does not. This is the same fact given in R. So R correctly explains A.

Final Answer:
Both (A) and (R) are True, and (R) correctly explains (A). This is option (A).
Was this answer helpful?
0
0