Updated on 2025-09-18 GMT+08:00

CREATE VIEW

Function

CREATE VIEW is used to create a view with a specified name on LakeFormation.

Syntax

1
2
3
4
CREATE [ OR REPLACE ] [schema_name.]view_name 
[ ( col_name col_type [ COMMENT col_comment ] [, ... ] ) ]
[ COMMENT view_comment ]
AS select_stmt;

Parameter Description

  • OR REPLACE

    If a view with the same name exists, it will create a view and overwrite the metadata of the old view.

  • schema_name

    The name of the database to which the view belongs. If no database name is specified, the view is created within the current_schema.

  • view_name

    Name of the view to be created, with a length that cannot exceed 63 characters.

  • view_comment

    Comment information for the view, which can be specified as any string.

  • select_stmt

    Query statement.

Examples

Create a view based on the ORC table.

1
2
CREATE TABLE test_table1 (a int, b bool, c text) store as orc;
CREATE VIEW v as select * from test_table;