SOL-C01 · Question #8
A Snowflake environment has two databases, 'DEV DB' and 'PROD DB'. A table 'EMPLOYEES' exists in both databases with identical schemas. A developer needs to create a view in 'DEV DB' that references…
The correct answer is C. CREATE OR REPLACE VIEW DEV DB.PUBLIC.EMPLOYEE VIEW AS SELECT FROM PROD E. CREATE SECURE VIEW DEV DB.PUBLIC.EMPLOYEE VIEW AS SELECT FROM PROD. Note: The SQL in all choices appears truncated in this question - the key differences are likely in the CREATE VIEW syntax and how the cross-database table reference is written. Based on Snowflake principles and the stated correct answers: Options C and E are correct because…
Question
A Snowflake environment has two databases, 'DEV DB' and 'PROD DB'. A table 'EMPLOYEES' exists in both databases with identical schemas. A developer needs to create a view in 'DEV DB' that references the 'EMPLOYEES' table in 'PROD DB' to perform cross-database joins. Which of the following SQL statements will successfully create this view in 'DEV DB'?
Options
- ACREATE VIEW DEV DB.PUBLIC.EMPLOYEE VIEW AS SELECT FROM PROD
- BCREATE VIEW DEV DB.PUBLIC.EMPLOYEE VIEW AS SELECT FROM PROD
- CCREATE OR REPLACE VIEW DEV DB.PUBLIC.EMPLOYEE VIEW AS SELECT FROM PROD
- DCREATE OR REPLACE VIEW DEV DB.PUBLIC.EMPLOYEE VIEW AS SELECT FROM PROD
- ECREATE SECURE VIEW DEV DB.PUBLIC.EMPLOYEE VIEW AS SELECT FROM PROD
How the community answered
(37 responses)- A8% (3)
- B11% (4)
- C78% (29)
- D3% (1)
Explanation
Note: The SQL in all choices appears truncated in this question - the key differences are likely in the CREATE VIEW syntax and how the cross-database table reference is written. Based on Snowflake principles and the stated correct answers:
Options C and E are correct because Snowflake supports fully qualified three-part object names (database.schema.table), so a view in DEV_DB can legally reference PROD_DB.PUBLIC.EMPLOYEES in its SELECT statement. CREATE OR REPLACE VIEW (C) is idempotent and valid standard DDL, while CREATE SECURE VIEW (E) is also valid and adds row-level access policy enforcement - both are supported cross-database view syntaxes in Snowflake.
Why the distractors fail:
- A & B likely use
CREATE VIEWwithoutOR REPLACE, which will throw an error if the view already exists, or have malformed object name syntax. - D likely has a subtle syntax error (e.g., missing schema qualifier or incorrect database reference like
PRODinstead ofPROD_DB.PUBLIC.EMPLOYEES).
Memory tip: In Snowflake, cross-database references always require the full three-part name - database.schema.object. Think of it as a postal address: just saying "PROD" is like writing only a city name with no street or zip code - Snowflake won't know where to deliver.
Topics
Community Discussion
No community discussion yet for this question.