A data engineer needs to create an empty duplicate of an existing Amazon Athena table (which has 1,000 rows) to perform data processing. Which CREATE TABLE query will produce an empty copy of the table?
Choose an answer
Tap an option to check your answer.
Correct answer: CREATE TABLE new_table - AS SELECT * FROM old_table - WITH NO DATA;.
Why this is the answer
The CREATE TABLE newtable AS SELECT FROM oldtable WITH NO DATA; query correctly creates an empty duplicate of an existing Athena table. The WITH NO DATA clause is crucial as it ensures only the schema (structure) of oldtable is copied to newtable, without transferring any of the 1,000 rows. The option CREATE TABLE newtable LIKE oldtable; is not a valid Athena SQL syntax for creating a table from an existing one's schema. While LIKE is used in some SQL dialects, Athena (which uses Presto/Trino) does not support it for this purpose. CREATE TABLE newtable AS SELECT FROM oldtable; would create a new table with both the schema and all 1,000 rows from oldtable, which is not an empty duplicate. CREATE TABLE newtable AS SELECT FROM oldtable WHERE 1=1; is functionally identical to CREATE TABLE newtable AS SELECT FROM oldtable; because WHERE 1=1 is always true and thus filters out no rows, resulting in a full copy of the table and its data.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed