Databricks Data Engineer Associate exam dumps

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

Select 2

You are working with a Delta Lake table named customers, which contains the columns customer_id, name, and email. The customer_id column is intended to be the primary key. To ensure that the customer_id is unique across all rows, which of the following approaches can you use in Databricks?

  1. A

    Use the Delta Lake MERGE INTO operation to enforce uniqueness on customer_id.

  2. B

    Perform a group-by operation on customer_id and filter rows with a count greater than 1 to identify duplicates.

  3. C

    Leverage a Databricks SQL query with SELECT DISTINCT on customer_id and compare the result count with the total row count.

  4. D

    Enable Delta Lake's built-in primary key constraint feature.

  5. E

    Use a DROP DUPLICATES operation on customer_id to automatically enforce uniqueness.

Show answer and explanation

Correct answers: B, C

Explanation

To validate that a primary key is unique, you need to identify duplicates in the customer_id column. A group-by operation with filtering or a SQL query with SELECT DISTINCT are effective methods to ensure uniqueness. Delta Lake does not provide built-in primary key constraints or automatic enforcement mechanisms, so manual validation approaches are required.

  • A. Incorrect.

    The MERGE INTO operation is used to upsert data but does not inherently enforce primary key uniqueness. It cannot validate that customer_id values are unique across all rows.

  • B. Correct.

    Performing a group-by operation on customer_id and filtering rows with a count greater than 1 is a valid approach to identify duplicates and ensure customer_id uniqueness.

  • C. Correct.

    Using a SQL query with SELECT DISTINCT on customer_id and comparing the distinct count to the total row count is a valid way to validate that customer_id is unique across all rows.

  • D. Incorrect.

    Delta Lake currently does not have a built-in primary key constraint feature as of October 2023, so this option is not applicable.

  • E. Incorrect.

    The DROP DUPLICATES operation eliminates duplicate rows but does not validate or enforce primary key uniqueness on a specific column.

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