SQL - Aggregate FunctionsWhat does COUNT(column_name) count in SQL?AOnly rows where <code>column_name</code> is NOT NULLBOnly rows where <code>column_name</code> is NULLCAll rows in the tableDRows where any column is NOT NULLCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand COUNT(column_name) behaviorCOUNT(column_name) counts only rows where the specified column is NOT NULL.Step 2: Contrast with COUNT(*)Unlike COUNT(*), it ignores rows where the column has NULL values.Final Answer:Only rows where column_name is NOT NULL -> Option AQuick Check:COUNT(column) = counts non-NULL column values [OK]Quick Trick: COUNT(column) skips NULLs in that column only [OK]Common Mistakes:MISTAKESAssuming COUNT(column) counts all rowsConfusing NULL and NOT NULL countsThinking COUNT(column) counts NULLs
Master "Aggregate Functions" in SQL9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More SQL Quizzes Advanced Joins - Non-equi joins - Quiz 12easy Advanced Joins - FULL OUTER JOIN behavior - Quiz 9hard GROUP BY and HAVING - How GROUP BY changes query execution - Quiz 13medium INNER JOIN - How the join engine matches rows - Quiz 8hard LEFT and RIGHT JOIN - Finding unmatched rows with LEFT JOIN - Quiz 8hard LEFT and RIGHT JOIN - Finding unmatched rows with LEFT JOIN - Quiz 9hard LEFT and RIGHT JOIN - Multiple LEFT JOINs in one query - Quiz 3easy Table Relationships - Referential integrity enforcement - Quiz 6medium Table Relationships - One-to-one relationship design - Quiz 3easy Table Relationships - Referential integrity enforcement - Quiz 3easy