CREATE VIEW

Translation from PostgreSQL to Snowflake

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Applies to

Description

This command creates a view in a database, which is run every time the view is referenced in a query.

For more information, please refer to CREATE VIEW documentation.

Grammar Syntax

CREATE [OR REPLACE] [TEMP | TEMPORARY] [RECURSIVE] VIEW <name> [ ( <column_name> [, ...] ) ]
    [ WITH ( view_option_name [= view_option_value] [, ... ] ) ]
    AS <query>
    [ WITH [ CASCADED | LOCAL ] CHECK OPTION ]

Code Examples

[OR REPLACE] [TEMP | TEMPORARY] [RECURSIVE]

Input Code:

Output Code:

WITH CHECK CLAUSE

This WITH CHECK CLAUSE clause on a view enforces that any data inserted or updated through the view must satisfy the view's defining conditions. LOCAL checks only the current view's conditions, while CASCADED checks conditions of the view and all underlying views. It prevents creating rows that are invisible through the view and cannot be used with recursive views.

Input Code:

Output Code:

WITH PARAMETERS OPTIONS

This WITH PARAMETERS OPTIONS allows setting optional properties for the view, such as how modifications through the view are checked (check_option) and whether to enforce row-level security (security_barrier).

Input Code:

Output Code:

VALUES OPTION

Input Code:

Output Code:

Last updated