Support table comment and column comment for view (#1799)
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
# SHOW FULL COLUMNS
|
||||
## description
|
||||
This statement is used to view some information about columns of a table.
|
||||
|
||||
Syntax:
|
||||
SHOW FULL COLUMNS FROM tbl;
|
||||
|
||||
## example
|
||||
|
||||
1. View the column information of specified table
|
||||
|
||||
SHOW FULL COLUMNS FROM tbl;
|
||||
|
||||
## keyword
|
||||
|
||||
SHOW,FULL,COLUMNS
|
||||
@ -0,0 +1,29 @@
|
||||
# SHOW TABLE STATUS
|
||||
|
||||
## description
|
||||
|
||||
This statement is used to view some information about Table.
|
||||
|
||||
Syntax:
|
||||
|
||||
SHOW TABLE STATUS
|
||||
[FROM db] [LIKE "pattern"]
|
||||
|
||||
Explain:
|
||||
|
||||
1. This statement is mainly used to be compatible with MySQL grammar. At present, only a small amount of information such as Comment is displayed.
|
||||
|
||||
## Example
|
||||
|
||||
1. View the information of all tables under the current database
|
||||
|
||||
SHOW TABLE STATUS;
|
||||
|
||||
|
||||
2. View the information of the table whose name contains example in the specified database
|
||||
|
||||
SHOW TABLE STATUS FROM DB LIKE "% example%";
|
||||
|
||||
## Keyword
|
||||
|
||||
SHOW,TABLE,STATUS
|
||||
@ -3,14 +3,15 @@
|
||||
|
||||
### Syntax
|
||||
|
||||
CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [database.]table_name
|
||||
(column_definition1[, column_definition2, ...])
|
||||
[ENGINE = [olap|mysql|broker]]
|
||||
[key_desc]
|
||||
[partition_desc]
|
||||
[distribution_desc]
|
||||
[PROPERTIES ("key"="value", ...)];
|
||||
[BROKER PROPERTIES ("key"="value", ...)];
|
||||
CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [database.]table_name
|
||||
(column_definition1[, column_definition2, ...])
|
||||
[ENGINE = [olap|mysql|broker]]
|
||||
[key_desc]
|
||||
[COMMENT "table comment"]
|
||||
[partition_desc]
|
||||
[distribution_desc]
|
||||
[PROPERTIES ("key"="value", ...)]
|
||||
[BROKER PROPERTIES ("key"="value", ...)];
|
||||
|
||||
1. column_definition
|
||||
|
||||
@ -222,6 +223,7 @@ CREATE [EXTERNAL] TABLE [IF NOT EXISTS] [database.]table_name
|
||||
)
|
||||
ENGINE=olap
|
||||
AGGREGATE KEY(k1, k2)
|
||||
COMMENT "my first doris table"
|
||||
DISTRIBUTED BY HASH(k1) BUCKETS 32
|
||||
PROPERTIES ("storage_type"="column");
|
||||
```
|
||||
|
||||
@ -1,22 +1,42 @@
|
||||
# CREATE VIEW
|
||||
## Description
|
||||
This statement is used to create a logical view
|
||||
Grammar:
|
||||
CREATE VIEW [IF NOT EXISTS]
|
||||
[db_name.]view_name (column1[, column2, ...])
|
||||
AS query
|
||||
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
|
||||
|
||||
Explain:
|
||||
1. Views are logical views without physical storage. All queries on views are equivalent to sub-queries corresponding to views.
|
||||
2. Query_stmt is arbitrarily supported SQL
|
||||
Explain:
|
||||
|
||||
1. Views are logical views without physical storage. All queries on views are equivalent to sub-queries corresponding to views.
|
||||
2. query_stmt is arbitrarily supported SQL.
|
||||
|
||||
## example
|
||||
1. Create 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;
|
||||
|
||||
1. Create 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 view with 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;
|
||||
|
||||
## keyword
|
||||
CREATE,VIEW
|
||||
|
||||
CREATE,VIEW
|
||||
|
||||
|
||||
Reference in New Issue
Block a user