Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

I know the statement:

create table xyz_new as select * from xyz;

Which copies the structure and the data, but what if I just want the structure?

1 Answer

0 votes
by (40.7k points)
edited by

You can use Where clause because it won’t select any rows:

create table xyz_new as select * from xyz where 1=0;

Are you interested in learning SQL from the basics! Refer to this video on SQL provided by Intellipaat:

Note: When you are creating a copy of an ORACLE table without copying the data then the things such as: indexes, triggers, sequences, materialized view logs, things that don’t handle partitions and some constraints also won't be copied to the new table from the original table. 

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...