pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
new table with a select
5+ messages / 4 participants
[nested] [flat]

* new table with a select
@ 2011-08-25 09:35  ppdcc@sapo.pt
  0 siblings, 1 reply; 5+ messages in thread

From: ppdcc@sapo.pt @ 2011-08-25 09:35 UTC (permalink / raw)
  To: pgsql-sql

Hello to all,


Can anybody tell me the sql instruction to create a new table with a  
select of other table?

I need to create a new table based on paralell of a table of lines.  
Can anybody post to me a example?

Can?t be a buffer, must be lines.

Thanks







^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* new table with a select
@ 2011-08-25 09:44  ppdcc@sapo.pt
  0 siblings, 1 reply; 5+ messages in thread

From: ppdcc@sapo.pt @ 2011-08-25 09:44 UTC (permalink / raw)
  To: pgsql-sql



Hello to all,


Can anybody tell me the sql instruction to create a new table with a  
select of other table?

I need to create a new table based on paralell of a table of lines.  
Can anybody post to me a example?

Can?t be a buffer, must be lines.

Thanks









^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: new table with a select
@ 2011-08-25 09:48  Julien Cigar <jcigar@ulb.ac.be>
  parent: ppdcc@sapo.pt
  0 siblings, 1 reply; 5+ messages in thread

From: Julien Cigar @ 2011-08-25 09:48 UTC (permalink / raw)
  To: pgsql-sql

create table foo as select * from bar;

just add "where 1=2" if you just want the schema

On 08/25/2011 11:44, ppdcc@sapo.pt wrote:
>
>
> Hello to all,
>
>
> Can anybody tell me the sql instruction to create a new table with a
> select of other table?
>
> I need to create a new table based on paralell of a table of lines. Can
> anybody post to me a example?
>
> Can?t be a buffer, must be lines.
>
> Thanks
>
>
>
>
>
>
>


-- 
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.

Attachments:

  [text/x-vcard] jcigar.vcf (290B, ../../4E561A6A.60807@ulb.ac.be/2-jcigar.vcf)
  download | inline:
begin:vcard
fn:Julien Cigar
n:Cigar;Julien
org;quoted-printable:Belgian Biodiversity Platform;ULB (Universit=C3=A9 Libre de Bruxelles)
adr:;;;Brussels;;;Belgium
email;internet:jcigar@ulb.ac.be
tel;work:+32(0)26505752
x-mozilla-html:FALSE
url:http://www.biodiversity.be
version:2.1
end:vcard

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: new table with a select
@ 2011-08-25 10:44  Florian Weimer <fweimer@bfk.de>
  parent: Julien Cigar <jcigar@ulb.ac.be>
  0 siblings, 0 replies; 5+ messages in thread

From: Florian Weimer @ 2011-08-25 10:44 UTC (permalink / raw)
  To: Julien Cigar <jcigar@ulb.ac.be>; +Cc: 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@bfk.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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: new table with a select
@ 2011-08-26 07:06  MIkhail Puzanov <misha.puzanov@gmail.com>
  parent: ppdcc@sapo.pt
  0 siblings, 0 replies; 5+ messages in thread

From: MIkhail Puzanov @ 2011-08-26 07:06 UTC (permalink / raw)
  To: ppdcc@sapo.pt; +Cc: pgsql-sql

Hi,


2011/8/25 <ppdcc@sapo.pt>

> Hello to all,
>
>
> Can anybody tell me the sql instruction to create a new table with a select
> of other table?
>
> I need to create a new table based on paralell of a table of lines. Can
> anybody post to me a example?
>
>
CREATE TABLE t AS
SELECT * FROM x;

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2011-08-26 07:06 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-08-25 09:35 new table with a select ppdcc@sapo.pt
2011-08-26 07:06 ` MIkhail Puzanov <misha.puzanov@gmail.com>
2011-08-25 09:44 new table with a select ppdcc@sapo.pt
2011-08-25 09:48 ` Julien Cigar <jcigar@ulb.ac.be>
2011-08-25 10:44   ` Florian Weimer <fweimer@bfk.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox