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 either the system privilege USE ANY SCHEMA or the object privilege USAGE on the target schema, or the schema must be owned by you or one of your assigned roles.

  • You need the system privilege CREATE ANY TABLE, or CREATE TABLE if the table is created in a schema owned by you or one of your assigned roles.
  • 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;