nerdexam
Amazon

DEA-C01 · Question #230

A data engineer is using an AWS Glue ETL job to remove outdated customer records from a table that contains customer account information. The data engineer is using the following SQL command to remove

The correct answer is A. All customer records that exist in both the customer accounts table and the. The SQL MERGE statement compares rows between a target table (accounts, aliased as t) and a source table (monthly_accounts_update, aliased as s) based on the join condition t.customer = s.customer. The WHEN MATCHED THEN DELETE clause specifies that whenever a row in the target ta

Data Ingestion and Transformation

Question

A data engineer is using an AWS Glue ETL job to remove outdated customer records from a table that contains customer account information. The data engineer is using the following SQL command to remove customers that exist in a table named monthly_accounts_update table from the customer accounts table:

MERGE INTO accounts t USING monthly_accounts_update s ON t.customer = s.customer WHEN MATCHED THEN DELETE What will happen when the data engineer runs the SQL command?

Options

  • AAll customer records that exist in both the customer accounts table and the
  • BOnly customer records that are present in both tables will be retained in the customer accounts
  • CThe monthly_accounts_update table will be deleted.
  • DNo records will be deleted because the command syntax is not valid in AWS Glue.

How the community answered

(62 responses)
  • A
    90% (56)
  • B
    3% (2)
  • C
    2% (1)
  • D
    5% (3)

Explanation

The SQL MERGE statement compares rows between a target table (accounts, aliased as t) and a source table (monthly_accounts_update, aliased as s) based on the join condition t.customer = s.customer. The WHEN MATCHED THEN DELETE clause specifies that whenever a row in the target table has a matching customer in the source table, that row is deleted from the target. Therefore, all customer records in the accounts table whose customer value also appears in monthly_accounts_update will be deleted. Option B is wrong because only the matched rows are deleted, not retained. Option C is wrong because the MERGE command never deletes the source table. Option D is wrong because this is valid SQL syntax supported by AWS Glue.

Topics

#AWS Glue#ETL#SQL#Data Transformation

Community Discussion

No community discussion yet for this question.

Full DEA-C01 Practice