🔥 40% Off Crucial Exams Memberships — This Week Only

3 days, 5 hours remaining!

AWS Certified Data Engineer Associate DEA-C01 Practice Question

An AWS Glue job loads yesterday's records into an Amazon Redshift table named stage_txn. Each record has the columns txn_id (unique identifier) and updated_at (timestamp). The job must upsert data into the prod_txn table by keeping only the most recent version of each txn_id and removing any older duplicates, all within a single SQL statement that runs inside Redshift. Which solution satisfies these requirements and follows Redshift best practices?

  • Use a MERGE statement with a subquery that selects the latest row per txn_id, for example: MERGE INTO prod_txn AS p USING (SELECT * FROM stage_txn QUALIFY ROW_NUMBER() OVER (PARTITION BY txn_id ORDER BY updated_at DESC)=1) AS s ON p.txn_id = s.txn_id WHEN MATCHED THEN UPDATE SET ... WHEN NOT MATCHED THEN INSERT ...;

  • Insert DISTINCT txn_id and MAX(updated_at) from stage_txn into a temporary table, join it back to stage_txn to find full rows, insert those into prod_txn, and run VACUUM DELETE on prod_txn afterwards.

  • Create a view on stage_txn that filters duplicates with QUALIFY and schedule separate UPDATE and INSERT statements against prod_txn inside a transaction.

  • Run DELETE FROM prod_txn USING stage_txn WHERE prod_txn.txn_id = stage_txn.txn_id; then INSERT INTO prod_txn SELECT * FROM stage_txn;

AWS Certified Data Engineer Associate DEA-C01
Data Ingestion and Transformation
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot