Databricks Data Engineer Associate exam dumps

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

Select 2

You are working with a large dataset stored in a Delta table in Databricks. The table is expected to have a unique primary key column named id. As a data engineer, you need to validate that the id column contains unique values across all rows in the table. Which of the following approaches can be used to ensure this validation?

  1. A

    Use the COUNT function to compare the total number of rows in the table with the count of distinct values in the id column.

  2. B

    Create a new Delta table and enforce a primary key constraint on the id column.

  3. C

    Use the dropDuplicates function on the id column and check if the resulting DataFrame has the same number of rows as the original table.

  4. D

    Run a query with the GROUP BY id clause and filter for groups where the count of id is greater than 1.

  5. E

    Enable Delta table constraints and define a UNIQUE constraint on the id column within the Delta table.

Show answer and explanation

Correct answers: A, D

Explanation

To validate the uniqueness of a primary key in a Delta table, you can use SQL-based approaches such as comparing the total row count with the count of distinct values or identifying duplicates using GROUP BY. Delta Lake does not currently support enforcing primary key or UNIQUE constraints directly at the table level, so workarounds like SQL queries or programmatic checks are required for this validation.

  • A. Correct.

    This is a valid approach. Comparing the total row count with the count of distinct id values will help determine if all values in the id column are unique.

  • B. Incorrect.

    Delta Lake does not currently support enforcing primary key constraints directly within a Delta table.

  • C. Incorrect.

    Using the dropDuplicates function to check for uniqueness is not an efficient or reliable method for validating primary key uniqueness due to potential performance issues with large datasets.

  • D. Correct.

    This approach is valid. Running a query with GROUP BY id and filtering for groups with a count greater than 1 will help identify duplicate id values, ensuring primary key uniqueness.

  • E. Incorrect.

    Delta Lake does not have built-in support for enabling UNIQUE constraints directly at the table level.

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