Creating new table with SELECT INTO in SQL [duplicate] Creating new table with SELECT INTO in SQL [duplicate] oracle oracle

Creating new table with SELECT INTO in SQL [duplicate]


The syntax for creating a new table is

CREATE TABLE new_tableASSELECT *  FROM old_table

This will create a new table named new_table with whatever columns are in old_table and copy the data over. It will not replicate the constraints on the table, it won't replicate the storage attributes, and it won't replicate any triggers defined on the table.

SELECT INTO is used in PL/SQL when you want to fetch data from a table into a local variable in your PL/SQL block.