Re: Copy table structure - Mailing list pgsql-novice

From Louise Cofield
Subject Re: Copy table structure
Date
Msg-id 003101c38d05$e9c1c910$7801a8c0@Louise
Whole thread Raw
In response to Copy table structure  (Anshuman Kanwar <ansh@expertcity.com>)
List 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@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Anshuman Kanwar
Sent: Saturday, October 04, 2003 1:22 PM
To: pgsql-novice@postgresql.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


pgsql-novice by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Full Outer Join with dates as index?
Next
From: Bruno Wolff III
Date:
Subject: Re: Serial Column Tweaking