CREATE TABLE AS - create a new table from the results of a query

SYNOPSIS

 

CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name [ (column_name [, ...] ) ]
    AS query

DESCRIPTION Description

CREATE TABLE AS creates a data table and the SELECT command from the table is filled out. SELECT name and type of fields and output fields of the table related. (But you can explicitly given a list of field names override the column names in the SELECT's).

CREATE TABLE AS and a bit like creating a view, but it is a relatively large difference between the two: it creates a new table and only SELECT once to fill the new table. The new table will not track subsequent changes in the source table SELECT is done. In contrast, every time the query time, a view re-evaluates its defining SELECT statement.

PARAMETERS Parameters

TEMPORARY or TEMP

 If this option is declared, the table is created as a temporary table. TABLE see the CREATE [ create_table (7)] for details.
table_name

 To create the table name (can be a schema-qualified).
column_name

 Name of the field. If no field name, it is taken from the output column names of the query. If a table is created EXECUTE command, then the current list of field names will not be declared.
query

 A query (that is, a SELECT command or an EXECUTE command runs a prepared SELECT command), please refer to the SELECT [respectively the SELECT (7)] or EXECUTE [ the Execute (L)] for a description of the syntax can be used.

NOTES Note


 This command from INTO functionally equivalent to the SELECT [ select_into (7)], but we recommend that you use this command, because it is less likely to use and other aspects of the SELECT ... INTO syntax confusion.  

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11077687.html