
Answer-first summary for fast verification
Answer: `INSERT OVERWRITE` replaces data by default, whereas `CREATE OR REPLACE` replaces both data and schema by default.
The key difference between `INSERT OVERWRITE` and `CREATE OR REPLACE TABLE` (CRAS) lies in their default behaviors: `INSERT OVERWRITE` only overwrites the data within a table, while CRAS can modify both the data and the schema of the table, such as adding new columns or changing the data types of existing columns. It's important to note that `INSERT OVERWRITE` can overwrite schema only if `spark.databricks.delta.schema.autoMerge.enabled` is set to `true`; otherwise, the command will fail in case of a schema mismatch.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
What distinguishes the INSERT OVERWRITE command from the CREATE OR REPLACE TABLE command in Databricks?
A
INSERT OVERWRITE maintains historical data versions by default, while CREATE OR REPLACE clears the historical data versions by default.
B
INSERT OVERWRITE replaces data by default, whereas CREATE OR REPLACE replaces both data and schema by default.
C
Both commands are functionally identical and yield the same outcomes.
D
INSERT OVERWRITE clears historical data versions by default, while CREATE OR REPLACE maintains the historical data versions by default.
E
INSERT OVERWRITE replaces data and schema by default, whereas CREATE OR REPLACE replaces data by default.
No comments yet.