How can we deduplicate Bronze raw ingestion records retaining the latest update per order?
Partitioning by order_id and sorting by updated_at DESC isolates the latest clean record in bronze-to-silver staging.
Bronze to Silver Lakehouse ELT, removing duplicate streaming deliveries, idempotent ingestion.
SELECT *
FROM (
SELECT
*,
ROW_NUMBER() OVER (
PARTITION BY order_id
ORDER BY updated_at DESC
) AS rn
FROM source_orders
) cleaned
WHERE rn = 1;Practice typing production-grade SQL code for Deduplicate Source Data.