SELECT INTO

Purpose

Using this command you can create a table, similar to CREATE TABLE AS. Refer to CREATE TABLE for more information.

Prerequisites

  • You need to have the system privilege CREATE TABLE if you need to create tables in your own schema or in that of an assigned role or CREATE ANY TABLE.
  • You need the appropriate SELECT privileges for all referenced objects.

Syntax

select_into::=

SELECT INTO

Usage Notes

  • If columns are not directly referenced in the select list, but as compound expressions, then aliases must be specified for these columns.
  • For detailed information about this syntax, refer to SELECT section.

Example

SELECT * INTO TABLE t2 FROM t1 ORDER BY 1;