Re: new table with a select

From: Florian Weimer <fweimer(at)bfk(dot)de>
To: Julien Cigar <jcigar(at)ulb(dot)ac(dot)be>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: new table with a select
Date: 2011-08-25 10:44:16
Message-ID: 821uw993en.fsf@mid.bfk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Julien Cigar:

> create table foo as select * from bar;
>
> just add "where 1=2" if you just want the schema

There's also this:

CREATE TABLE foo (LIKE bar);

This gives you more control over what aspects of the table are
duplicated; see the documentation for details.

--
Florian Weimer <fweimer(at)bfk(dot)de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message gvim 2011-08-25 14:21:02 Add one column to another
Previous Message Julien Cigar 2011-08-25 09:48:26 Re: new table with a select