CertLumen

Databricks Data Analyst Associate · Section 5 · 15% of the exam

Fix a query to achieve the desired results.

One of the objectives of the Databricks Certified Data Analyst Associate exam, in the section “Analyzing Queries”. Here is what it covers, the points to remember and a question to try.

What it covers

Use DESCRIBE HISTORY and time travel to audit who changed a table, validate results and compare versions, then recognize and fix the classic SQL bugs (join filters, NULL logic, fan-out, aggregates) that make a query return the wrong answer.

Points to remember

  • Every Delta write is a new version; DESCRIBE HISTORY (or the Catalog Explorer History tab) lists them newest first; SELECTs create no versions.
  • History columns: version, timestamp, userName, operation, operationParameters (predicates), operationMetrics (row and file counts), job, notebook.
  • History retention = delta.logRetentionDuration (30 days); time travel also needs the data files kept by delta.deletedFileRetentionDuration (7 days, the VACUUM threshold).
  • Compare results with VERSION AS OF, TIMESTAMP AS OF or @v; EXCEPT lists changed rows; table_changes needs change data feed.
  • RESTORE TABLE ... TO VERSION AS OF undoes changes by adding a new version and needs MODIFY.

Try a question

An analyst wants to compare a Unity Catalog managed table with its state 20 days ago. DESCRIBE HISTORY lists versions going back 28 days, but a query using TIMESTAMP AS OF a date 20 days ago fails. The table uses default retention settings. Why?

  1. ATable history is kept for only 7 days by default, so the older versions it lists are only cached copies
  2. BTime travel needs data files that are kept only for delta.deletedFileRetentionDuration, 7 days
  3. CTime travel requires change data feed, which has not been enabled on this table
  4. DTIMESTAMP AS OF works only on external tables, so managed tables must use VERSION AS OF
Show the answer

B. History (the transaction log) is governed by delta.logRetentionDuration, 30 days by default, while time travel also needs data files, which VACUUM removes after delta.deletedFileRetentionDuration, 7 days by default. For Unity Catalog managed tables, time travel to versions older than that threshold is blocked. Increase both properties in advance for longer comparisons; table history is not a long-term backup.

Written for practice in the style of the exam: never a question from the real exam.

In the course

The lesson Delta history for auditing, and fixing query results teaches this objective (about 40 minutes), and 12 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.

More in this section

← Previous objective · All 39 objectives · Next objective →