Update table.md

This commit is contained in:
Anna 2021-04-19 15:55:28 +03:00 committed by GitHub
parent abeccff02e
commit 781980159c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,18 +50,15 @@ Creates a table with the same result as that of the [table function](../../../sq
### From SELECT query {#from-select-query} ### From SELECT query {#from-select-query}
``` sql ``` sql
CREATE TABLE [IF NOT EXISTS] [db.]table_name ENGINE = engine AS SELECT ... CREATE TABLE [IF NOT EXISTS] [db.]table_name[(name1 [type1], name2 [type2], ...)] ENGINE = engine AS SELECT ...
``` ```
Creates a table with a structure like the result of the `SELECT` query, with the `engine` engine, and fills it with data from `SELECT`. Creates a table with a structure like the result of the `SELECT` query, with the `engine` engine, and fills it with data from `SELECT`. Also you can explicitly specify columns description.
If the table already exists and `IF NOT EXISTS` is specified, the query wont do anything. If the table already exists and `IF NOT EXISTS` is specified, the query wont do anything.
There can be other clauses after the `ENGINE` clause in the query. See detailed documentation on how to create tables in the descriptions of [table engines](../../../engines/table-engines/index.md#table_engines). There can be other clauses after the `ENGINE` clause in the query. See detailed documentation on how to create tables in the descriptions of [table engines](../../../engines/table-engines/index.md#table_engines).
!!! warning "Warning"
The `SELECT` results must match the table description, otherwise an exception is thrown.
**Example** **Example**
Query: Query: