Files
doris/docs/en/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-VIEW.md
Mingyu Chen 74a482ca7f [fix] fix docs build bug (#9293)
After this PR #9272, the `docs/build_help_zip.sh` will run failed.
This PR fix this issue.
But the help module still has some parse problem, I will fix it in next PR.

This CL mainly changes:
1. fix `docs/build_help_zip.sh` error
2. remove `sql-reference-v2` to `sql-reference`
3. modify build extension github action to run `docs/build_help_zip.sh`
2022-04-28 22:19:04 +08:00

1.9 KiB

title, language
title language
CREATE-VIEW en

CREATE-VIEW

Name

CREATE VIEW

Description

This statement is used to create a logical view grammar:

CREATE VIEW [IF NOT EXISTS]
 [db_name.]view_name
 (column1[ COMMENT "col comment"][, column2, ...])
AS query_stmt

illustrate:

  • Views are logical views and have no physical storage. All queries on the view are equivalent to the sub-queries corresponding to the view.
  • query_stmt is any supported SQL

Example

  1. Create the view example_view on example_db

    CREATE VIEW example_db.example_view (k1, k2, k3, v1)
    AS
    SELECT c1 as k1, k2, k3, SUM(v1) FROM example_table
    WHERE k1 = 20160112 GROUP BY k1,k2,k3;
    
  2. Create a view with a comment

    CREATE VIEW example_db.example_view
    (
        k1 COMMENT "first key",
        k2 COMMENT "second key",
        k3 COMMENT "third key",
        v1 COMMENT "first value"
    )
    COMMENT "my first view"
    AS
    SELECT c1 as k1, k2, k3, SUM(v1) FROM example_table
    WHERE k1 = 20160112 GROUP BY k1,k2,k3;
    

Keywords

CREATE, VIEW

Best Practice