CREATE TABLE AS... syntax?

Started by Dr. Evilalmost 25 years ago4 messagesgeneral
Jump to latest
#1Dr. Evil
drevil@sidereal.kz

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

#2Len Morgan
len-morgan@crcom.net
In reply to: Dr. Evil (#1)
Re: CREATE TABLE AS... syntax?

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

I think you want something like:

SELECT number INTO TABLE foo FROM account ;

len morgan

#3Calvin Dodge
caldodge@fpcc.net
In reply to: Dr. Evil (#1)
Re: CREATE TABLE AS... syntax?

"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

#4Tamsin
tg_mail@bryncadfan.co.uk
In reply to: Dr. Evil (#1)
RE: CREATE TABLE AS... syntax?

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

tamsin

Show quoted text

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Dr. Evil
Sent: 25 April 2001 23:46
To: pgsql-general@postgresql.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@postgresql.org