CertLumen

Databricks Data Engineer Associate · Section 3 · 22% of the exam

Perform data deduplication operations and aggregate operations on DataFrames, such as count, approximate count distinct, and mean, summary.

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

What it covers

Spark SQL for data engineers: schemas and the three-level namespace, CTAS and INSERT INTO/OVERWRITE, views vs temp views vs global temp views, CTEs, CASE, window functions, higher-order array functions, and mixing Python with SQL safely.

Points to remember

  • SCHEMA and DATABASE are synonyms; use three-level names catalog.schema.table in Unity Catalog.
  • CTAS infers the schema from the query; CREATE OR REPLACE TABLE replaces data and may change the schema while keeping history.
  • INSERT INTO appends; INSERT OVERWRITE replaces all rows but requires a matching schema; REPLACE WHERE replaces matching rows only.
  • View = stored query in UC; temp view = current session; global temp view = global_temp on one classic cluster, not supported on serverless.
  • A CTE exists for one statement only; CASE without ELSE yields NULL.

Try a question

workspace.dea_lab.customer_updates contains several rows per customer_id, each with an updated_at timestamp. The silver layer needs exactly one row per customer — the most recent one — with all of its columns. Which query is correct?

  1. ASELECT customer_id, MAX(updated_at) AS updated_at FROM workspace.dea_lab.customer_updates GROUP BY customer_id
  2. BSELECT * FROM workspace.dea_lab.customer_updates QUALIFY ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY updated_at DESC) = 1
  3. CSELECT * FROM workspace.dea_lab.customer_updates QUALIFY ROW_NUMBER() OVER (PARTITION BY customer_id, updated_at ORDER BY updated_at DESC) = 1
  4. DSELECT * FROM workspace.dea_lab.customer_updates QUALIFY RANK() OVER (PARTITION BY customer_id ORDER BY updated_at ASC) = 1
Show the answer

B. ROW_NUMBER() assigns 1 to the newest row in each customer partition when ordered by updated_at DESC, and QUALIFY keeps only that row while retaining every column. This window-function pattern is the standard way to keep the latest record per key.

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

In the course

2 lessons teach this objective: Spark SQL Essentials, Deduplication & Aggregations (about 90 minutes), and 14 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 29 objectives · Next objective →