An open-data team wants to materialize a new parks table from a cleaned staging query in SQL. Which statement pattern should they use?
Select an answer to reveal the explanation.
Short Explanation
CTAS is printing a clean parks pamphlet from the staging draft—one SQL statement builds the published table from the cleaned query. You'll get no published table from a CREATE VIEW AS SELECT to publish, since it's just a saved query with no stored rows. You'll also get no new table from INSERT INTO to publish or a SELECT with a CTE to publish, since one's for an existing table and the other's gone when the statement ends.
Full Explanation
To materialize a new parks table from a cleaned staging query in SQL, use CREATE TABLE AS SELECT (CTAS). CTAS publishes the curated municipal table in one statement from the cleaned query, establishing metadata and data together for open-data consumers and internal parks analytics. It is the standard SQL pattern to build a new curated table from a select without a separate empty CREATE plus INSERT ritual when a full materialization is intended. Using CREATE VIEW AS SELECT from the cleaned staging query to publish the parks table does not materialize a physical table, leaving only a saved query definition with no stored curated dataset for analytics. Inserting with INSERT INTO the parks table from the cleaned staging query to publish the parks table requires the destination table to already exist and therefore does not create the initial curated dataset from the staging query. Selecting with a CTE from the cleaned staging query to publish the parks table runs only for the duration of that single statement and does not persist the data, so consumers cannot query a published parks table afterward. Exam caveat: CTAS creates and populates in one step; if the table must be refreshed in place later, teams often move to CREATE OR REPLACE TABLE or MERGE patterns—here the goal is to materialize and publish a new table from the cleaned staging query, not to define a view, load into an existing table with INSERT, or run a transient CTE query. Operational check: run CTAS from the cleaned parks staging query into the open-data schema, DESCRIBE the new table, spot-check row counts and key columns against staging, grant read to open-data consumers, and avoid using a view definition as a publish step when materialization is required.
Prefer to study offline? Printable PDF study book + test engine ($7.50, unofficial). These questions stay free here.