Databricks Data Engineer Associate Question 289
Single answerYou are tasked with analyzing historical data from a Delta Lake table named 'sales_data'. A specific version of the table, identified as version 5, contains the data you need. Which of the following commands will allow you to query this specific version of the table?
- A
SELECT * FROM delta.
/mnt/delta/sales_dataVERSION AS OF 5 - B
SELECT * FROM delta.
/mnt/delta/sales_dataTIMESTAMP AS OF '2023-01-01T00:00:00Z' - C
SELECT * FROM delta.
/mnt/delta/sales_dataVERSION_TIME 5 - D
SELECT * FROM delta.
/mnt/delta/sales_dataVERSION 5
Show answer and explanation
Correct answer: A
Explanation
To query a specific version of a Delta table, you must use the VERSION AS OF clause in the SELECT statement. This allows you to access historical versions of the table stored in Delta Lake.
- A. Correct.
Correct. This is the correct syntax to query a specific version of a Delta table using the VERSION AS OF clause.
- B. Incorrect.
Incorrect. This syntax is used for querying a Delta table at a specific point in time using TIMESTAMP AS OF, not for querying a specific version.
- C. Incorrect.
Incorrect. This syntax is invalid as 'VERSION_TIME' is not a recognized Delta Lake query option.
- D. Incorrect.
Incorrect. This syntax is invalid as 'VERSION' without 'AS OF' is not a correct Delta Lake query option.