nerdexam
Databricks

DATABRICKS-CERTIFIED-DATA-ENGINEER-ASSOCIATE · Question #34

Which of the following commands will return the number of null values in the member_id column?

The correct answer is C. SELECT count_if(member_id IS NULL) FROM my_table. count_if(condition) is a SQL aggregate function that counts the number of rows where the specified boolean condition evaluates to true. Using count_if(member_id IS NULL) directly counts rows where member_id is NULL, which is exactly the goal. Option A - count(member_id) - is a…

Submitted by yuriko_h· Apr 18, 2026ELT with Spark SQL and Python

Question

Which of the following commands will return the number of null values in the member_id column?

Options

  • ASELECT count(member_id) FROM my_table;
  • BSELECT count(member_id) - count_null(member_id) FROM my_table;
  • CSELECT count_if(member_id IS NULL) FROM my_table;
  • DSELECT null(member_id) FROM my_table;
  • ESELECT count_null(member_id) FROM my_table;

How the community answered

(27 responses)
  • A
    7% (2)
  • B
    4% (1)
  • C
    85% (23)
  • E
    4% (1)

Explanation

count_if(condition) is a SQL aggregate function that counts the number of rows where the specified boolean condition evaluates to true. Using count_if(member_id IS NULL) directly counts rows where member_id is NULL, which is exactly the goal. Option A - count(member_id) - is a common trap: SQL's count() function ignores NULL values by design, so it returns the count of non-null rows, not null rows. count_null() and null() are not valid standard SQL functions. Option B mixes valid and invalid functions.

Topics

#Spark SQL#NULL values#Aggregate Functions#Data Querying

Community Discussion

No community discussion yet for this question.

Full DATABRICKS-CERTIFIED-DATA-ENGINEER-ASSOCIATE Practice