DP-750 practice question 1 of 10

You have an Azure Databricks workspace that is enabled for Unity Catalog and contains two managed Delta tables named sales.schema1.table1 and…

Full set: 91 questions
You have an Azure Databricks workspace that is enabled for Unity Catalog and contains two managed Delta tables named sales.schema1.table1 and sales.schema1.table2. sales.schema1.table1 contains sales data from the current year. sales.schema1.table2 contains historical data. You need to load all the rows from sales.schema1.table1 into sales.schema1.table2. The solution must preserve any existing data in sales.schema1.table2 and minimize processing effort. Which command should you run?
Answer options
A: INSERT INTO sales.schema1.table2 SELECT * FROM sales.schema1.table1; Correct answer
B: CREATE TABLE sales.schema1.table2 AS SELECT * FROM sales.schema1.table1;
C: INSERT OVERWRITE sales.schema1.table2 SELECT * FROM sales.schema1.table1;
D: CREATE OR REPLACE TABLE sales.schema1.table2 AS SELECT * FROM sales.schema1.table1;
Correct Answer:
A. INSERT INTO sales.schema1.table2 SELECT * FROM sales.schema1.table1;
Explanation

The INSERT INTO command is the standard SQL method for appending new rows to an existing table. In this scenario, it will take all rows from the sales.schema1.table1 (current year's data) and add them to sales.schema1.table2 (historical data). This action fulfills the core requirements of the task: it loads the new data while preserving all the existing historical data in the target table. It is the most direct and efficient command for this operation.

Why Incorrect

B. CREATE TABLE ... AS SELECT would fail because the target table, sales.schema1.table2, already exists. This command is used only for creating new tables.
C. INSERT OVERWRITE would first delete all existing historical data from sales.schema1.table2 before inserting the new data, violating the requirement to preserve existing data.
D. CREATE OR REPLACE TABLE would completely drop and recreate sales.schema1.table2, deleting all existing historical data and replacing it with only the data from table1.

References

1. Databricks SQL Language Reference

INSERT INTO: "Inserts new rows into a table. You can specify the values for each column or provide the result of a query." This confirms the append behavior.

Source: Microsoft

Azure Databricks Documentation. Section: INSERT INTO.

2. Databricks SQL Language Reference

INSERT OVERWRITE: "Replaces the data in a table with the new values... Any existing data in the table is deleted." This confirms the destructive nature of the command.

Source: Microsoft

Azure Databricks Documentation. Section: INSERT OVERWRITE DIRECTORY and INSERT OVERWRITE TABLE.

3. Databricks SQL Language Reference

CREATE TABLE: "If you specify a table that already exists

an error is thrown." This explains why option B is incorrect. The CREATE OR REPLACE TABLE variant is also described

which "replaces the definition of the table if it exists."

Source: Microsoft

Azure Databricks Documentation. Section: CREATE TABLE.

4. Delta Lake Documentation

Table batch reads and writes: "To add new data to an existing Delta table

use the append mode... INSERT INTO in SQL." This explicitly links the append requirement to the INSERT INTO command for Delta tables.

Source: Databricks Documentation

Delta Lake guide. Section: Table batch reads and writes > Append.

Scroll to Top