Creating Table from another Table : Oracle

Copy Table to a new table with some condition
______________________________________________

SQL> CREATE TABLE newTable AS (SELECT * FROM emp WHERE sal > 2000);

CREATE TABLE testholder AS (SELECT * FROM histholder WHERE cardholder=325073128);

Copying table structure not data
_______________________________

SQL> CREATE TABLE My_myTables AS SELECT * FROM myTable WHERE 1=0;

CREATE TABLE testholder AS SELECT * FROM histholder WHERE 1=0;

### note this will not copy or create indexes, you have to create indexes explicitly.

The table is created with no rows if the query returned no rows.

________________________________________________________________

CREATE TABLE Y AS SELECT * FROM X WHERE 1 = 2;

Leave a Reply