Courseiva

DA0-002 Data Acquisition and Preparation Practice Question

A data analyst is profiling a dataset and finds that the 'email' column contains some NULL values. Which SQL query can be used to count how many rows have a NULL email?

⚠ Common exam trap

The trap is the seductive '= NULL' syntax — it looks natural to beginners but is always wrong in SQL, and the exam expects you to know that NULL requires IS NULL.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

SELECT COUNT(*) FROM table WHERE email IS NULL

SELECT COUNT(*) FROM table WHERE email IS NULL correctly counts rows where email is NULL. COUNT(*) counts all rows in the filtered result set, and IS NULL is the only valid comparison operator for NULL in SQL. This is the standard, portable way to count NULLs.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    SELECT COUNT(email) FROM table WHERE email = NULL

    Why it's wrong here

    email = NULL evaluates to UNKNOWN under three-valued logic, so WHERE filters out every row and COUNT returns zero regardless of actual NULLs. It is tempting because equality is the natural way to test values, and it is correct when comparing against a concrete string such as email = 'unknown'.

  • ✗

    SELECT SUM(CASE WHEN email IS NULL THEN 1 END) FROM table

    Why it's wrong here

    SUM(CASE WHEN email IS NULL THEN 1 END) returns NULL, not a count, because the CASE yields NULL for non-matching rows and SUM ignores them, leaving no rows to total when none match. It is tempting as a portable conditional-aggregation idiom, correct when the ELSE branch supplies 0.

  • ✗

    SELECT COUNT(ISNULL(email)) FROM table

    Why it's wrong here

    ISNULL(email) converts NULL to a substitute value, so COUNT then tallies every row including non-NULL emails, producing the full row count rather than the NULL count. It is tempting because ISNULL is genuinely used to replace NULLs with defaults in output, which is correct when displaying values, not counting them.

  • ✓

    SELECT COUNT(*) FROM table WHERE email IS NULL

    Why this is correct

    `COUNT(*)` tallies every row returned by the `WHERE` clause, and `IS NULL` is the only predicate that reliably tests for the absence of a value, since `email = NULL` evaluates to UNKNOWN and matches nothing. This directly satisfies the stem's requirement to count rows whose email column holds NULL.

About these practice questions

One of 1,004 original DA0-002 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

This DA0-002 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DA0-002 exam.