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:
Denis Zhuravlev 2020-07-21 16:22:33 -03:00 committed by GitHub
parent c4381e8a5d
commit ae8c6e57c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 dont 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 youve 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.