Mohit BAnsal
Mohit BAnsal

Reputation: 1581

Make New Table in SQL with same Schema

I have a table called W_US and I want to create W_UK in oracle with same schema as for W_US.

Upvotes: 2

Views: 1144

Answers (2)

APC
APC

Reputation: 146229

These sort of questions are a warning flag, because the obvious solution is to clone the CREATE TABLE script for W_US (through the magic of 'Save as ...') and edit the clone so it creates W_UK.

The fact that this avenue appears to be closed to you suggests that you do not have your DDL statements under source control. This is a bad state of affairs. All our code should be under source control, including the scripts which build the database schema.

Upvotes: 0

Doug Porter
Doug Porter

Reputation: 7897

It sounds like you want to create a table called W_UK that has the same columns and types as W_US. You could do the following:

create table W_UK as 
select *
  from W_US
 where 1 = 2;

Upvotes: 1

Related Questions