SELECT INTO

    Description

    Note: 1The keyword is a Beta feature.

    SELECT INTO creates a new table and fills it with data computed by a query. The data is not returned to the client, as it is with a normal SELECT. The new table’s columns have the names and data types associated with the output columns of the SELECT.

    The RECURSIVE keyword can be enabled by setting the server configuration parameter to true.

    Note: The RECURSIVE keyword is a Beta feature.

    TEMPORARY

    TEMP

    If specified, the table is created as a temporary table.

    new_table

    Examples

    Create a new table films_recent consisting of only recent entries from the table :

    1. SELECT * INTO films_recent FROM films WHERE date_prod >=
    2. '2016-01-01';

    The SQL standard uses SELECT INTO to represent selecting values into scalar variables of a host program, rather than creating a new table. The Greenplum Database usage of SELECT INTO to represent table creation is historical. It is best to use for this purpose in new applications.

    See Also

    , CREATE TABLE AS

    Parent topic: