Home >Database >Mysql Tutorial >How to Create a Table Structure in Oracle Without Copying Data?
Creating a Table Structure Without Copying Data in Oracle
When duplicating an Oracle table, it's common to use the statement "create table xyz_new as select * from xyz;" to copy both the structure and data. However, if you only require the structure without data, there's a simple solution.
Solution:
To create a copy of a table's structure without its data, use the following statement:
create table xyz_new as select * from xyz where 1=0;
By adding the "where 1=0" clause, you ensure that no rows are selected from the original table, effectively copying only its structure.
Limitations:
It's important to note that this method has some limitations:
Therefore, if you require these elements to be included in the new table, you may need to employ alternative methods or consider creating the table manually with the desired settings.
The above is the detailed content of How to Create a Table Structure in Oracle Without Copying Data?. For more information, please follow other related articles on the PHP Chinese website!