1999-07-22 17:09:15 +02:00
|
|
|
<!--
|
2000-07-21 20:51:24 +02:00
|
|
|
$Header: /cvsroot/pgsql/doc/src/sgml/ref/select_into.sgml,v 1.6 2000/07/21 18:51:24 momjian Exp $
|
1999-07-22 17:09:15 +02:00
|
|
|
Postgres documentation
|
|
|
|
-->
|
|
|
|
|
1999-06-14 09:37:05 +02:00
|
|
|
<refentry id="SQL-SELECTINTO">
|
|
|
|
<refmeta>
|
1999-07-22 17:09:15 +02:00
|
|
|
<refentrytitle id="SQL-SELECTINTO-TITLE">
|
1999-07-14 22:32:59 +02:00
|
|
|
SELECT INTO
|
1999-06-14 09:37:05 +02:00
|
|
|
</refentrytitle>
|
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
<refnamediv>
|
|
|
|
<refname>
|
1999-07-14 22:32:59 +02:00
|
|
|
SELECT INTO
|
1999-06-14 09:37:05 +02:00
|
|
|
</refname>
|
|
|
|
<refpurpose>
|
1999-07-14 22:32:59 +02:00
|
|
|
Create a new table from an existing table or view
|
1999-06-14 09:37:05 +02:00
|
|
|
</refpurpose></refnamediv>
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<refsynopsisdivinfo>
|
1999-07-22 17:09:15 +02:00
|
|
|
<date>1999-07-20</date>
|
1999-06-14 09:37:05 +02:00
|
|
|
</refsynopsisdivinfo>
|
|
|
|
<synopsis>
|
2000-02-21 02:13:52 +01:00
|
|
|
SELECT [ ALL | DISTINCT [ ON ( <replaceable class="PARAMETER">expression</replaceable> [, ...] ) ] ]
|
|
|
|
<replaceable class="PARAMETER">expression</replaceable> [ AS <replaceable class="PARAMETER">name</replaceable> ] [, ...]
|
|
|
|
[ INTO [ TEMPORARY | TEMP ] [ TABLE ] <replaceable class="PARAMETER">new_table</replaceable> ]
|
|
|
|
[ FROM <replaceable class="PARAMETER">table</replaceable> [ <replaceable class="PARAMETER">alias</replaceable> ] [, ...] ]
|
1999-06-14 09:37:05 +02:00
|
|
|
[ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
|
|
|
|
[ GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...] ]
|
|
|
|
[ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ]
|
2000-02-21 02:13:52 +01:00
|
|
|
[ { UNION [ ALL ] | INTERSECT | EXCEPT } <replaceable class="PARAMETER">select</replaceable> ]
|
|
|
|
[ ORDER BY <replaceable class="PARAMETER">column</replaceable> [ ASC | DESC | USING <replaceable class="PARAMETER">operator</replaceable> ] [, ...] ]
|
|
|
|
[ FOR UPDATE [ OF <replaceable class="PARAMETER">class_name</replaceable> [, ...] ] ]
|
2000-07-21 20:51:24 +02:00
|
|
|
[ LIMIT { <replaceable class="PARAMETER">count</replaceable> | ALL } [ { OFFSET | , } <replaceable class="PARAMETER">start</replaceable> ] ]
|
1999-06-14 09:37:05 +02:00
|
|
|
</synopsis>
|
|
|
|
|
|
|
|
<refsect2 id="R2-SQL-SELECTINTO-1">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1998-09-22</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
|
|
|
Inputs
|
|
|
|
</title>
|
|
|
|
<para>
|
1999-07-14 22:32:59 +02:00
|
|
|
All input fields are described in detail for
|
1999-07-16 16:32:06 +02:00
|
|
|
<xref linkend="sql-select-title" endterm="sql-select-title">.
|
1999-06-14 09:37:05 +02:00
|
|
|
</para>
|
|
|
|
</refsect2>
|
|
|
|
|
|
|
|
<refsect2 id="R2-SQL-SELECTINTO-2">
|
|
|
|
<refsect2info>
|
|
|
|
<date>1998-09-22</date>
|
|
|
|
</refsect2info>
|
|
|
|
<title>
|
|
|
|
Outputs
|
|
|
|
</title>
|
|
|
|
<para>
|
1999-07-14 22:32:59 +02:00
|
|
|
All output fields are described in detail for
|
1999-07-16 16:32:06 +02:00
|
|
|
<xref linkend="sql-select-title" endterm="sql-select-title">.
|
1999-06-14 09:37:05 +02:00
|
|
|
</para>
|
|
|
|
</refsect2>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1 id="R1-SQL-SELECTINTO-1">
|
|
|
|
<refsect1info>
|
|
|
|
<date>1998-09-22</date>
|
|
|
|
</refsect1info>
|
|
|
|
<title>
|
|
|
|
Description
|
|
|
|
</title>
|
|
|
|
<para>
|
1999-07-14 22:32:59 +02:00
|
|
|
<command>SELECT INTO</command> creates a new table from the results
|
|
|
|
of a query. Typically, this
|
1999-06-14 09:37:05 +02:00
|
|
|
query draws data from an existing table, but any SQL query is allowed.
|
1999-07-14 22:32:59 +02:00
|
|
|
|
1999-06-14 09:37:05 +02:00
|
|
|
<note>
|
1999-07-14 22:32:59 +02:00
|
|
|
<para>
|
1999-07-22 17:09:15 +02:00
|
|
|
<xref linkend="sql-createtableas-title" endterm="sql-createtableas-title">
|
|
|
|
is functionally equivalent to the <command>SELECT INTO</command> command.
|
1999-07-14 22:32:59 +02:00
|
|
|
</para>
|
1999-06-14 09:37:05 +02:00
|
|
|
</note>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
1999-07-14 22:32:59 +02:00
|
|
|
sgml-omittag:nil
|
1999-06-14 09:37:05 +02:00
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../reference.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:"/usr/lib/sgml/catalog"
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
-->
|