1. Home
  2. Data Science
  3. SQL for Data Analysis
  4. For a column email containing two NULLs among ten rows…

Added 30 Nov -0001

For a column email containing two NULLs among ten rows, what does COUNT(email) return?

  1. 2, because it counts only the NULL entries
  2. NULL, because aggregate functions skip the column
  3. 8, because NULL values are not counted Correct answer
  4. 10, because it counts every row

Correct answer

C. 8, because NULL values are not counted

15 views

MCQSEXAM

Explanation

COUNT(column) counts only non-NULL values, so the two missing entries are excluded and the result is 8. COUNT(*) instead counts rows regardless of content and would return 10, which is why it is the right choice for a total row count. This NULL-skipping behaviour applies to AVG and SUM too, so AVG(email_score) divides by the non-null count rather than by the row count.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More SQL for Data Analysis MCQs

Practise all SQL for Data Analysis MCQs

Similar MCQs