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?
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_table WHERE 1=1;
In Amazon Athena, you can use CREATE TABLE AS SELECT with WITH NO DATA to create an empty copy of an existing table’s schema:
“The query CREATE TABLE new_table AS SELECT * FROM old_table WITH NO DATA; creates a new table with the same schema but without copying over the data.”
– Ace the AWS Certified Data Engineer - Associate Certification - version 2 - apple.pdf
This is the most efficient way to create an empty version of the existing table.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit