SELECT INTO - results from a query creates a new table

SYNOPSIS

 

SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
    * | expression [ AS output_name ] [, ...]
    INTO [ TEMPORARY | TEMP ] [ TABLE ] new_table
    [ FROM from_item [, ...] ]
    [ WHERE condition ]
    [ GROUP BY expression [, ...] ]
    [ HAVING condition [, ...] ]
    [ { UNION | INTERSECT | EXCEPT } [ ALL ] select ]
    [ ORDER BY expression [ ASC | DESC | USING operator ] [, ...] ]
    [ LIMIT { count | ALL } ]
    [ OFFSET start ]
    [ FOR UPDATE [ OF tablename [, ...] ] ]

DESCRIPTION Description

SELECT INTO creates a new table from the results of a query. Data is not returned to the client, which is different from a normal SELECT. The new table name SELECT and having an output associated with a field (same) and data types.

PARAMETERS Parameters

TEMPORARY or TEMP

If specified keyword, then the table is created as a temporary table. TABLE Refer to the CREATE [ the create_table (. 7)] for details.
new_table

To create a table name table (schema-qualified).


All other fields are entered in the SELECT [ SELECT (. 7)] described in detail.

 

NOTES Note

TABLE the AS the CREATE [ create_table_as effect (7)] and SELECT INTO same. We recommend using the CREATE TABLE AS syntax, since SELECT INTO is not standard syntax. In fact, this type can not be used SELECT INTO ECPG or in PL / pgSQL, since they explain the INTO clause are different. 

Guess you like

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