[
http://issues.apache.org/jira/browse/DERBY-64?page=comments#action_12443902 ]
Christian d'Heureuse commented on DERBY-64:
-------------------------------------------
No, the normal INSERT...SELECT statement does not create a table. The table
must already exist for the normal INSERT...SELECT statement.
Most SQL DBMS provide a method to store a query result into a table so that the
table is automatically created.
For DB2 and Oracle the syntax is:
CREATE TABLE new_table AS SELECT ...
For MS-SQL Server the syntax is:
SELECT ... INTO new_table FROM ...
This is convenient for complex SQL scripts that store intermediate results in
temporary tables. Without such a statement, every intermediate table has to be
created with a CREATE TABLE statement, before it can be filled with INSERT ...
SELECT, and each CREATE TABLE statement for a temporary table must repeat the
full columns definition.
> Create a table with a query
> ---------------------------
>
> Key: DERBY-64
> URL: http://issues.apache.org/jira/browse/DERBY-64
> Project: Derby
> Issue Type: New Feature
> Components: SQL
> Reporter: Christian d'Heureuse
>
> I suggest to implement a SQL statement to create and fill a table with a
> query, without having to write the columns definition.
> e.g.:
> CREATE TABLE new_table AS SELECT ...;
> or:
> SELECT ... INTO new_table FROM ...;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira