AWS Certified Data Engineer – Associate (DEA-C01) — Question 144
A data engineer needs to create an empty copy of an existing table in Amazon Athena to perform data processing tasks. The existing table in Athena contains 1,000 rows.
Which query will meet this requirement?
Answer options
- A. CREATE TABLE new_table - LIKE old_table;
- B. CREATE TABLE new_table - AS SELECT * FROM old_table - WITH NO DATA;
- C. CREATE TABLE new_table - AS SELECT * FROM old_table;
- D. CREATE TABLE new_table - as SELECT * FROM old_cable - WHERE 1=1;
Correct answer: B
Explanation
Option B is correct because it uses the 'WITH NO DATA' clause, which creates a new table without copying any rows from the original table. Option A would create a new table with the same structure but still does not ensure it's empty for processing. Option C would copy all 1,000 rows into the new table, which is not the requirement. Option D also attempts to copy rows based on a condition, which does not fulfill the need for an empty table.