
Answer-first summary for fast verification
Answer: `CREATE TABLE new_table AS (SELECT * FROM old_table) WITH NO DATA;`
In Amazon Athena, to create an empty table with the same schema as an existing table without copying the data, you use a Create Table As Select (CTAS) statement with the `WITH NO DATA` clause. Option D is correct as it follows this syntax. Option A will copy all the data into the new table. Option B uses an INSERT statement, which assumes the target table already exists and also copies the data. Option C uses standard SQL `LIKE` syntax, which is not the standard way to accomplish this in Athena compared to the CTAS `WITH NO DATA` approach.
Author: Ritesh Yadav
Ultimate access to all questions.
Question 51/60
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?
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;
No comments yet.