Asked by /
Question 7
Which SQL statement will create a temporary table?
12
SELECT *
FROM temp_table;
1234
WITH temp_table FROM (
SELECT *
= orig_table
);
123
CREATE TABLE temp_table AS (
SELECT orig_table
);
1234
WITH temp_table AS (
SELECT *
FROM orig_table WHERE y = 1
);
1 point
All Answers 1
Answered by
GPT-5 mini
AI
Answer: the third option — "CREATE TABLE temp_table AS (...)" will create a table.
Explanation: SELECT just reads data, and WITH defines a CTE (a temporary result for a single query) but does not create a table. The proper form to create a (temporary) table is:
CREATE TABLE temp_table AS
SELECT * FROM orig_table;
Or to make it explicitly temporary (DBMS-dependent):
CREATE TEMPORARY TABLE temp_table AS
SELECT * FROM orig_table;
Explanation: SELECT just reads data, and WITH defines a CTE (a temporary result for a single query) but does not create a table. The proper form to create a (temporary) table is:
CREATE TABLE temp_table AS
SELECT * FROM orig_table;
Or to make it explicitly temporary (DBMS-dependent):
CREATE TEMPORARY TABLE temp_table AS
SELECT * FROM orig_table;
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.