BlackFriday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Databricks Exam Databricks-Certified-Professional-Data-Engineer Topic 4 Question 13 Discussion

Actual exam question for Databricks's Databricks-Certified-Professional-Data-Engineer exam
Question #: 13
Topic #: 4
[All Databricks-Certified-Professional-Data-Engineer Questions]

The view updates represents an incremental batch of all newly ingested data to be inserted or updated in the customers table.

The following logic is used to process these records.

MERGE INTO customers

USING (

SELECT updates.customer_id as merge_ey, updates .*

FROM updates

UNION ALL

SELECT NULL as merge_key, updates .*

FROM updates JOIN customers

ON updates.customer_id = customers.customer_id

WHERE customers.current = true AND updates.address <> customers.address

) staged_updates

ON customers.customer_id = mergekey

WHEN MATCHED AND customers. current = true AND customers.address <> staged_updates.address THEN

UPDATE SET current = false, end_date = staged_updates.effective_date

WHEN NOT MATCHED THEN

INSERT (customer_id, address, current, effective_date, end_date)

VALUES (staged_updates.customer_id, staged_updates.address, true, staged_updates.effective_date, null)

Which statement describes this implementation?

Show Suggested Answer Hide Answer

Contribute your Thoughts:

Viki
4 months ago
I believe option C is the best choice because it maintains old values and inserts new ones.
upvoted 0 times
...
Lindsay
4 months ago
Wow, this is a nice bit of SQL. I like how it handles the case where the address has changed but the customer is still current. Definitely a Type 2 table implementation.
upvoted 0 times
Kenneth
3 months ago
I agree, it's definitely a Type 2 table implementation. The logic for handling updates is well thought out.
upvoted 0 times
...
Kenneth
3 months ago
C) The customers table is implemented as a Type 2 table; old values are maintained but marked as no longer current and new values are inserted.
upvoted 0 times
...
...
Teddy
4 months ago
I'm pretty sure this is a Type 2 table as well. Maintaining the historical data is important for analytical purposes, and the logic here seems to handle that well.
upvoted 0 times
Kris
3 months ago
This logic seems well-designed for maintaining the history of customer data in the table.
upvoted 0 times
...
Jessenia
3 months ago
Definitely, it's important for analysis and reporting to have that historical context.
upvoted 0 times
...
An
3 months ago
I agree, it makes sense to keep track of historical data in this scenario.
upvoted 0 times
...
Von
3 months ago
I think the correct answer is C) The customers table is implemented as a Type 2 table; old values are maintained but marked as no longer current and new values are inserted.
upvoted 0 times
...
...
Florinda
4 months ago
I'm not sure, but I think option A could also be a possibility.
upvoted 0 times
...
Pearline
4 months ago
This looks like a Type 2 slowly changing dimension implementation to me. The old customer records are marked as no longer current, and new records are inserted. Pretty straightforward approach.
upvoted 0 times
Hyman
4 months ago
Yes, the old records are marked as no longer current and new ones are inserted.
upvoted 0 times
...
Carlton
4 months ago
I agree, it does seem like a Type 2 slowly changing dimension implementation.
upvoted 0 times
...
...
Vanda
5 months ago
I agree with Maryanne, option C makes sense.
upvoted 0 times
...
Maryanne
5 months ago
I think the correct answer is C.
upvoted 0 times
...

Save Cancel