Difficulty: Easy
Correct Answer: Applies — COUNT(column) skips NULLs; only non-NULL rows are counted
Explanation:
Introduction / Context:
This question assesses understanding of how SQL aggregate functions handle NULL values, specifically the difference between COUNT(column) and COUNT().
Given Data / Assumptions:
Concept / Approach:
Aggregates (SUM, AVG, MAX, MIN, COUNT(column)) generally skip NULL inputs; COUNT() is special because it counts rows, not values. Understanding this distinction is crucial for accurate reports.
Step-by-Step Solution:
Identify which COUNT variant is used.Recall rule: COUNT(column) counts only non-NULL values in that column.Therefore rows where column_name IS NULL are not tallied.Hence the statement is correct.
Verification / Alternative check:
Quick test: a table with 3 rows where column values are (10, NULL, 30) yields COUNT(column)=2, COUNT()=3.
Why Other Options Are Wrong:
COUNT(column) does not include NULLs; DISTINCT is orthogonal (it deduplicates non-NULLs). COUNT(*) differs in semantics and always counts every row.
Common Pitfalls:
Expecting AVG on a column with NULLs to divide by total rows; it divides by the count of non-NULL values. Use COALESCE if you must treat NULLs as zeros.
Final Answer:
Applies — COUNT(column) skips NULLs; only non-NULL rows are counted
Discussion & Comments