Description
Supported engines: Presto and SparkSQL
Purpose: Create view.
Standard Statement
CREATE [ OR REPLACE ] VIEW [IF NOT EXISTS] view_name
[(column_name [COMMENT 'column_comment'][, ...])]
[COMMENT 'view_comment']
AS select_statement
Parameter
[IF NOT EXISTS]
: Create a view if no such view exists.
view_name
: View name
[(column_name [COMMENT 'column_comment'][, ...])]
: Column name, which can be followed by a column comment.
[COMMENT 'view_comment']
: View comment
select_statement
: Query statement.
Example
create or replace view db1.v1 as select x,y from tbl;
create view test_view (id comment 'test c1', name_length comment 'test name c2') as select id, length(name) from test;
Was this page helpful?