RE: CREATE TABLE AS... syntax?

Lists: pgsql-general
From: "Dr(dot) Evil" <drevil(at)sidereal(dot)kz>
To: pgsql-general(at)postgresql(dot)org
Subject: CREATE TABLE AS... syntax?
Date: 2001-04-25 22:45:38
Message-ID: 20010425224538.23078.qmail@sidereal.kz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


I'm trying to use CREATE TABLE AS under 7.03. There are no
examples in the guide, so I tried a few things:

CREATE TABLE foo (test INT4) AS SELECT number FROM account;

and

CREATE TABLE foo (test INT4) AS number FROM account;

and both of them give ERROR: parser: parse error at or near "as".
Any tips on how to use this?

Thanks


From: caldodge(at)fpcc(dot)net
To: pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE TABLE AS... syntax?
Date: 2001-04-26 03:42:05
Message-ID: 3AE7990D.397840A8@fpcc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

"Dr. Evil" wrote:
>
> I'm trying to use CREATE TABLE AS under 7.03. There are no
> examples in the guide, so I tried a few things:
>
> CREATE TABLE foo (test INT4) AS SELECT number FROM account;
>
> and
>
> CREATE TABLE foo (test INT4) AS number FROM account;
>
> and both of them give ERROR: parser: parse error at or near "as".
> Any tips on how to use this?

I think you want:

CREATE TABLE foo AS SELECT number AS test FROM account;

Calvin

--
Calvin Dodge
Certified Linux Bigot (tm)
http://www.caldodge.fpcc.net


From: "Tamsin" <tg_mail(at)bryncadfan(dot)co(dot)uk>
To: <pgsql-general(at)postgresql(dot)org>
Subject: RE: CREATE TABLE AS... syntax?
Date: 2001-04-26 12:16:57
Message-ID: NEBBKHBOBMJCHDMGKCNJCEPPCMAA.tg_mail@bryncadfan.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

i think its:
CREATE TABLE foo AS SELECT number FROM account;

tamsin

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Dr. Evil
> Sent: 25 April 2001 23:46
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] CREATE TABLE AS... syntax?
>
>
>
> I'm trying to use CREATE TABLE AS under 7.03. There are no
> examples in the guide, so I tried a few things:
>
> CREATE TABLE foo (test INT4) AS SELECT number FROM account;
>
> and
>
> CREATE TABLE foo (test INT4) AS number FROM account;
>
> and both of them give ERROR: parser: parse error at or near "as".
> Any tips on how to use this?
>
> Thanks
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>