COUNT(*) vs COUNT(email)?
Options
- They are identical and always return the same number
COUNT(*)counts all rows;COUNT(email)skips NULL emails (Correct option)COUNT(email)counts only the distinct emailsCOUNT(*)skips rows that contain any NULL
Answer
COUNT(*) counts all rows; COUNT(email) skips rows where email is NULL
Why
COUNT(*) counts rows, no matter what they contain.
COUNT(email) counts only rows where email has a value (not NULL). Most aggregate functions (SUM, AVG, COUNT(column)) ignore NULLs.
For unique values: COUNT(DISTINCT email).
Remember
COUNT(column) ignores NULLs.