
Answer-first summary for fast verification
Answer: CREATE OR REPLACE TABLE database_name.table_name (width INT, length INT, height INT);
The question requires creating an empty managed table that must be recreated and empty even if it already exists. Option C uses 'CREATE OR REPLACE TABLE' which will drop the existing table (if any) and create a new empty table with the specified schema. The syntax correctly specifies the database and table names, and defines the schema directly without the USING clause, which is appropriate for managed tables. Option A uses only 'CREATE TABLE' which would fail if the table already exists. Option B incorrectly uses the USING clause, which is typically for specifying data sources or formats, not for defining column schemas in this context. Option D has incorrect syntax with 'FROM database_name' and the USING clause. The community discussion shows 100% consensus for A, but this appears to be incorrect based on the requirement to handle existing tables; C is the correct choice for 'CREATE OR REPLACE' functionality.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
A data analyst needs to create an empty managed table named table_name in the database_name database with a specific schema. The table must be recreated and empty, even if it already exists.
Which command should the analyst run to accomplish this?
A
CREATE TABLE database_name.table_name USING (width INT, length INT, height INT);
B
CREATE OR REPLACE TABLE database_name.table_name USING (width INT, length INT, height INT);
C
CREATE OR REPLACE TABLE database_name.table_name (width INT, length INT, height INT);
D
CREATE OR REPLACE TABLE table_name FROM database_name USING (width INT, length INT, height INT);
No comments yet.