Re: Create an empty copy of another table

From: Andrew McMillan <Andrew(at)catalyst(dot)net(dot)nz>
To: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Create an empty copy of another table
Date: 2000-06-28 13:48:12
Message-ID: 395A021C.9A904F1@catalyst.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Andrew McMillan wrote:
>
> Thomas Weholt wrote:
> >
> > Hi,
> >
> > How do I create a new empty table that`s a copy of an allready existing one?
> > I need a way of putting the result of a select-statement into a temporary
> > table that`s an exact copy of the table it`s derived from and I`m not sure
> > how to do this. Obviously. I am just using one table to query at the time.
> >
> > Thomas
>
> CREATE TABLE t2 AS SELECT * FROM t1;

Woops!

CREATE TABLE t2 AS SELECT * FROM t1 WHERE pkey != pkey;

:-)
Andrew.

> --
> _____________________________________________________________________
> Andrew McMillan, e-mail: Andrew(at)cat-it(dot)co(dot)nz
> Catalyst IT Ltd, PO Box 10-225, Level 22, 105 The Terrace, Wellington
> Me: +64 (21) 635 694, Fax: +64 (4) 499 5596, Office: +64 (4) 499 2267

--
_____________________________________________________________________
Andrew McMillan, e-mail: Andrew(at)cat-it(dot)co(dot)nz
Catalyst IT Ltd, PO Box 10-225, Level 22, 105 The Terrace, Wellington
Me: +64 (21) 635 694, Fax: +64 (4) 499 5596, Office: +64 (4) 499 2267

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message davidb 2000-06-28 14:32:01 Re: Create an empty copy of another table
Previous Message Andrew McMillan 2000-06-28 13:41:55 Re: Create an empty copy of another table