Databricks Data Engineer Associate exam dumps

Databricks Data Engineer Associate practice question 140 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 140

Select 2

You are working with a Databricks Delta table named orders that contains the columns order_id and customer_id. You need to validate that each customer_id is associated with only one unique order_id. Which of the following approaches would achieve this validation?

  1. A

    Use a GROUP BY query on customer_id and check that the maximum count of order_id per customer_id is equal to 1.

  2. B

    Use the DISTINCT keyword on both customer_id and order_id and validate that the record count matches the total number of rows in the table.

  3. C

    Use the COUNT function with a window partitioned by customer_id and filter rows where the count of order_id is greater than 1.

  4. D

    Use the DROP DUPLICATES function on the customer_id column and ensure the resulting dataset has the same row count as the original table.

Show answer and explanation

Correct answers: A, C

Explanation

To ensure that each customer_id is associated with exactly one unique order_id, you can either group by customer_id and verify that no order_id count exceeds 1 (Option 1), or use a window function to count order_id values for each customer_id and identify violations (Option 3). Both approaches ensure data integrity for this validation.

  • A. Correct.

    Correct. Grouping by customer_id and ensuring the maximum count of order_id per customer_id is equal to 1 effectively validates that each customer_id is associated with only one unique order_id.

  • B. Incorrect.

    Incorrect. Using DISTINCT on both columns does not confirm that each customer_id maps to exactly one unique order_id; it only ensures that duplicate rows are removed.

  • C. Correct.

    Correct. Using a window function to count order_id occurrences per customer_id and filtering for counts greater than 1 will help identify violations of the one-to-one relationship.

  • D. Incorrect.

    Incorrect. Dropping duplicates on customer_id does not validate the uniqueness of order_id per customer_id, as it only removes duplicate customer_id entries.

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