Bird
0
0

What does COUNT(*) count in a SQL query?

easy📝 Conceptual Q1 of 15
SQL - Aggregate Functions
What does COUNT(*) count in a SQL query?
AOnly rows where all columns are NOT NULL
BAll rows, including those with NULL values in any column
COnly rows where the specified column is NOT NULL
DOnly rows with NULL values in any column
Step-by-Step Solution
Solution:
  1. Step 1: Understand what COUNT(*) does

    COUNT(*) counts every row in the table regardless of NULL values in any column.
  2. Step 2: Compare with other COUNT forms

    Unlike COUNT(column), COUNT(*) does not ignore NULLs because it counts rows, not column values.
  3. Final Answer:

    All rows, including those with NULL values in any column -> Option B
  4. Quick Check:

    COUNT(*) = counts all rows [OK]
Quick Trick: COUNT(*) counts all rows, ignoring NULLs in columns [OK]
Common Mistakes:
MISTAKES
  • Thinking COUNT(*) ignores rows with NULLs
  • Confusing COUNT(*) with COUNT(column)
  • Assuming COUNT(*) counts only non-NULL columns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes