Databricks Data Engineer Associate Question 273
Single answerYou are working as a data engineer and need to review the history of transactions on a Delta table named 'sales_data' to investigate recent changes. Which command should you use to retrieve the history of this Delta table?
- A
DESCRIBE HISTORY sales_data
- B
SELECT * FROM sales_data WHERE version = 'history'
- C
SHOW TRANSACTIONS ON sales_data
- D
ALTER TABLE sales_data SHOW HISTORY
Show answer and explanation
Correct answer: A
Explanation
To review the history of transactions for a Delta table, the correct command is DESCRIBE HISTORY. This command allows users to see a detailed log of operations, including timestamps, user information, and specific actions performed on the table. The other options provided are either invalid commands or do not serve the purpose of viewing transaction history in Delta Lake.
- A. Correct.
Correct. The
DESCRIBE HISTORYcommand is used in Databricks to view the transaction history of a Delta table, including changes such as updates, deletes, and merges. - B. Incorrect.
Incorrect. This is not a valid way to retrieve table transaction history. The
SELECTstatement cannot be used to access Delta table history directly. - C. Incorrect.
Incorrect. The
SHOW TRANSACTIONScommand does not exist in Databricks or Delta Lake and is not a valid option. - D. Incorrect.
Incorrect. The
ALTER TABLEcommand is not used for viewing history and does not support a 'SHOW HISTORY' clause.