Re: Copy table structure

From: "Louise Cofield" <lcofield(at)box-works(dot)com>
To: "'Anshuman Kanwar'" <ansh(at)expertcity(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Copy table structure
Date: 2003-10-07 19:05:02
Message-ID: 003101c38d05$e9c1c910$7801a8c0@Louise
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

CREATE TABLE table2 AS SELECT * FROM table1 WHERE 1=2;

(This creates the structure only -- no data will be transferred because
1 will never equal 2). :)

Louise

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of Anshuman Kanwar
Sent: Saturday, October 04, 2003 1:22 PM
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] Copy table structure

Hi all,

How do I copy only the table structure from one tabe to another.

Table A has some data but I just want to copy the number of columns and
the
column names from this table and create a table B. What is the best way
of
doing this ?

Thanks in advance,
-ansh

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message David Rickard 2003-10-07 19:25:23 Serial Column Tweaking
Previous Message Stephan Szabo 2003-10-07 18:55:19 Re: Full Outer Join with dates as index?