Databricks Data Engineer Associate exam dumps

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

Select 2

You are working on a Databricks table named 'sales_data' in the 'analytics' database. The table already exists, but you need to refresh its content with new data stored in a staging table named 'staging_sales_data'. The table schema and partitions remain unchanged. Which of the following approach(es) would correctly achieve this goal?

  1. A

    Use CREATE OR REPLACE TABLE analytics.sales_data AS SELECT * FROM staging_sales_data.

  2. B

    Use INSERT OVERWRITE TABLE analytics.sales_data SELECT * FROM staging_sales_data.

  3. C

    Use CREATE TABLE analytics.sales_data AS SELECT * FROM staging_sales_data.

  4. D

    Use INSERT INTO analytics.sales_data SELECT * FROM staging_sales_data.

  5. E

    Use CREATE OR REPLACE TABLE analytics.sales_data OPTIONS ('mergeSchema' = 'true') AS SELECT * FROM staging_sales_data.

Show answer and explanation

Correct answers: A, B

Explanation

The goal is to refresh the existing 'sales_data' table with new data from 'staging_sales_data'. CREATE OR REPLACE TABLE and INSERT OVERWRITE are valid approaches to replace the entire content of the table while keeping the schema intact. INSERT INTO appends data instead of replacing it, and CREATE TABLE will fail because the table already exists. The mergeSchema option is unnecessary here since the schema is not changing.

  • A. Correct.

    This is correct because CREATE OR REPLACE TABLE replaces the existing table and loads it with the new data from the staging table. This ensures the new content is fully refreshed.

  • B. Correct.

    This is correct because INSERT OVERWRITE replaces all the data in the target table with the data from the staging table without altering the schema or table definition.

  • C. Incorrect.

    This is incorrect because CREATE TABLE will fail if the table already exists. It does not support overwriting an existing table.

  • D. Incorrect.

    This is incorrect because INSERT INTO appends data to the target table, rather than replacing its content. This does not meet the requirement of refreshing the table's content.

  • E. Incorrect.

    This is incorrect because CREATE OR REPLACE TABLE with the mergeSchema option is used for schema evolution and is not relevant for this scenario, as the requirement states that the schema remains unchanged.

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