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
SCHEMAandDATABASEare synonyms; use three-level namescatalog.schema.tablein Unity Catalog.- CTAS infers the schema from the query;
CREATE OR REPLACE TABLEreplaces data and may change the schema while keeping history. INSERT INTOappends;INSERT OVERWRITEreplaces all rows but requires a matching schema;REPLACE WHEREreplaces matching rows only.- View = stored query in UC; temp view = current session; global temp view =
global_tempon one classic cluster, not supported on serverless. - A CTE exists for one statement only;
CASEwithoutELSEyields 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?
- A
SELECT customer_id, MAX(updated_at) AS updated_at FROM workspace.dea_lab.customer_updates GROUP BY customer_id - B
SELECT * FROM workspace.dea_lab.customer_updates QUALIFY ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY updated_at DESC) = 1 - C
SELECT * FROM workspace.dea_lab.customer_updates QUALIFY ROW_NUMBER() OVER (PARTITION BY customer_id, updated_at ORDER BY updated_at DESC) = 1 - D
SELECT * 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
- Implement data cleaning by reading bronze tables with PySpark/SQL, cleaning nulls, standardizing data types, and writing to new silver tables.
- Combine DataFrames with operations such as Inner join, left join, broadcast join, multiple keys, cross join, union, and union all.
- Manipulate columns, rows, and table structures by adding, dropping, splitting, renaming column names, applying filters, and exploding arrays.
- Understand the basic tuning parameters (spark.sql.shuffle.partitions, spark.default.parallelism, spark.executor/driver.memory, spark.sql.autoBroadcastJoinThreshold) and re-measure the performance.
- Understand the difference between, and how to build, Gold layer objects such as materialized views, views, streaming tables, and tables for BI and analytics teams in Unity Catalog.
- Apply data quality checks and validation rules to ensure reliable Silver and Gold datasets.