AWS Certified Data Engineer – Associate (DEA-C01) — Question 138
A data engineer needs to create a new empty table in Amazon Athena that has the same schema as an existing table named old_table.
Which SQL statement should the data engineer use to meet this requirement?
Answer options
- A. CREATE TABLE new_table AS SELECT * FROM old_tables;
- B. INSERT INTO new_table SELECT * FROM old_table;
- C. CREATE TABLE new_table (LIKE old_table);
- D. CREATE TABLE new_table AS (SELECT * FROM old_table) WITH NO DATA;
Correct answer: D
Explanation
The correct answer, D, creates a new table with the same schema as old_table without inserting any data. Option A attempts to create a table and insert data at the same time, which does not meet the requirement for an empty table. Option B tries to insert data into a new table that hasn't been created yet, and option C creates a table with the same structure but does not explicitly provide an empty table creation method.