SOL-C01 · Question #8
SOL-C01 Question #8: Real Exam Question with Answer & Explanation
The correct answer is C: CREATE OR REPLACE VIEW DEV DB.PUBLIC.EMPLOYEE VIEW AS SELECT FROM PROD. To create a view that references objects in other databases, you should fully qualify the object names in the 'SELECT statement. Both options create the view referencing the PROD DB. Option C uses CREATE OR REPLACE VIEW and option E uses CREATE SECURE VIEW' which are correct and
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
Explanation
To create a view that references objects in other databases, you should fully qualify the object names in the 'SELECT statement. Both options create the view referencing the PROD DB. Option C uses CREATE OR REPLACE VIEW and option E uses CREATE SECURE VIEW' which are correct and commonly used options for this scenerio. 'WITH READ ONLY' is not a supported clause for creating views in Snowflake. 'CREATE SECURE VIEW' creates a secure view which is recommended to protect the underlying objects' definition.
Topics
Community Discussion
No community discussion yet for this question.