Original Query:
"I am aware of the statement:
create table xyz_new as select * from xyz;
which duplicates both the schema and the data. However, what if I only need the schema?"
Solution:
To create a table copy without copying the data, simply add a WHERE clause that filters out all rows:
create table xyz_new as select * from xyz where 1=0;
This technique copies the table structure (columns, data types, constraints) without populating the table with any data.
Limitations:
While this method is efficient for copying the table structure, it has certain limitations:
The above is the detailed content of How to Create an Empty Table Copy with the Same Schema as an Existing Table in Oracle?. For more information, please follow other related articles on the PHP Chinese website!