mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Doc change. Update view.md (#12643)
* Update view.md OR REPLACE / ON CLUSTER * Update docs/en/sql-reference/statements/create/view.md Co-authored-by: Ivan Blinkov <github@blinkov.ru>
This commit is contained in:
parent
c4381e8a5d
commit
ae8c6e57c1
@ -7,14 +7,14 @@ toc_title: VIEW
|
||||
|
||||
Creates a new view. There are two types of views: normal and materialized.
|
||||
|
||||
## Normal {#normal}
|
||||
|
||||
Syntax:
|
||||
|
||||
``` sql
|
||||
CREATE [MATERIALIZED] VIEW [IF NOT EXISTS] [db.]table_name [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ...
|
||||
CREATE [OR REPLACE] VIEW [IF NOT EXISTS] [db.]table_name [ON CLUSTER] AS SELECT ...
|
||||
```
|
||||
|
||||
## Normal {#normal}
|
||||
|
||||
Normal views don’t store any data, they just perform a read from another table on each access. In other words, a normal view is nothing more than a saved query. When reading from a view, this saved query is used as a subquery in the [FROM](../../../sql-reference/statements/select/from.md) clause.
|
||||
|
||||
As an example, assume you’ve created a view:
|
||||
@ -37,6 +37,11 @@ SELECT a, b, c FROM (SELECT ...)
|
||||
|
||||
## Materialized {#materialized}
|
||||
|
||||
``` sql
|
||||
CREATE MATERIALIZED VIEW [IF NOT EXISTS] [db.]table_name [ON CLUSTER] [TO[db.]name] [ENGINE = engine] [POPULATE] AS SELECT ...
|
||||
```
|
||||
|
||||
|
||||
Materialized views store data transformed by the corresponding [SELECT](../../../sql-reference/statements/select/index.md) query.
|
||||
|
||||
When creating a materialized view without `TO [db].[table]`, you must specify `ENGINE` – the table engine for storing data.
|
||||
|
Loading…
Reference in New Issue
Block a user