Databricks Data Engineer Associate exam dumps

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

Single answer

You are working on a Databricks notebook and need to create a new table cleaned_customers from an existing table raw_customers, ensuring that duplicate rows are removed in the process. Which of the following commands will correctly achieve this?

  1. A

    CREATE TABLE cleaned_customers AS SELECT DISTINCT * FROM raw_customers

  2. B

    CREATE TABLE cleaned_customers AS SELECT * FROM raw_customers GROUP BY *

  3. C

    CREATE TABLE cleaned_customers AS SELECT * FROM raw_customers WHERE UNIQUE

  4. D

    INSERT INTO cleaned_customers SELECT DISTINCT * FROM raw_customers

Show answer and explanation

Correct answer: A

Explanation

The correct approach to create a new table from an existing table while removing duplicate rows is to use the CREATE TABLE ... AS SELECT DISTINCT ... syntax. This ensures that only unique rows from the existing table are included in the new table. The other options either use invalid SQL syntax or do not meet the requirements of the scenario.

  • A. Correct.

    This is the correct option. Using SELECT DISTINCT ensures that only unique rows are included in the new table cleaned_customers when created from raw_customers.

  • B. Incorrect.

    This is incorrect because GROUP BY * is not valid SQL syntax. The GROUP BY clause requires specific column names and cannot be used with *.

  • C. Incorrect.

    This is incorrect because WHERE UNIQUE is not valid SQL syntax in Databricks or SQL in general.

  • D. Incorrect.

    This is incorrect because the INSERT INTO statement would require cleaned_customers to already exist, which is not the case in this scenario.

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