Skip to main content
PreparationZone Logo
PreparationZone
Back to Fundamentals

Fundamentals · Medium · Free

COUNT vs COUNT(*) vs COUNT(column) — NULL behavior.

FresherFundamentalsDatabase Fundamentals
Model answer

COUNT and NULL

  • COUNT(*) counts rows including NULLs in columns.
  • COUNT(col) ignores NULL values in col.
  • AVG/SUM ignore NULL—skew averages if NULL means something.
sql
SELECT COUNT(*) , COUNT(email) FROM users;
Clarify NULL semantics—common trick question.