Databricks Data Engineer Associate exam dumps

Databricks Data Engineer Associate practice question 112 of 532

Databricks Certified Data Engineer Associate. Associate level, Databricks. Free question with the correct answer and a full explanation.

Databricks Data Engineer Associate Question 112

Select 2

You are tasked with analyzing a table named 'sales_data' in Databricks that contains the columns 'order_id', 'customer_id', and 'order_amount'. You want to identify the number of rows where 'customer_id' is null and compare it to the total number of rows in the table. Which of the following approaches correctly achieves this?

  1. A

    Use count_if(customer_id IS NULL) to count rows where 'customer_id' is null.

  2. B

    Use count(*) - count(customer_id) to derive the count of rows where 'customer_id' is null.

  3. C

    Use count(customer_id) to count rows where 'customer_id' is null.

  4. D

    Use count_if(customer_id IS NOT NULL) to count rows where 'customer_id' is not null.

  5. E

    Use count(*) to count rows where 'customer_id' is null.

Show answer and explanation

Correct answers: A, B

Explanation

To count rows where 'customer_id' is null, you can either use the count_if function with the condition IS NULL or calculate the difference between count(*) (total rows) and count(customer_id) (non-null rows). Both approaches are valid and commonly used for this type of analysis in Databricks.

  • A. Correct.

    Correct. The count_if function can be used with the condition IS NULL to directly count rows where 'customer_id' is null.

  • B. Correct.

    Correct. Subtracting count(customer_id) (which counts non-null values) from count(*) (which counts all rows) gives the count of rows where 'customer_id' is null.

  • C. Incorrect.

    Incorrect. The count(customer_id) function counts only non-null values in the 'customer_id' column, not null values.

  • D. Incorrect.

    Incorrect. The count_if(customer_id IS NOT NULL) function counts rows where 'customer_id' is not null, which is the opposite of what is required.

  • E. Incorrect.

    Incorrect. The count(*) function counts all rows in the table, regardless of whether 'customer_id' is null or not.

Timed practice exam

Take a Databricks Data Engineer Associate practice test under exam conditions

45 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam