Re: Query regarding Insert Statement!!!! - Mailing list pgsql-novice

From Juliet May
Subject Re: Query regarding Insert Statement!!!!
Date
Msg-id 001901c31bd4$6de7a460$a1d2a8c0@impsu.net
Whole thread Raw
In response to Query regarding Insert Statement!!!!  (sandeep bantia <s_bantia@yahoo.co.in>)
List pgsql-novice
The syntax for the insert query does not use set or parenthesis. Your query
should have looked like:
INSERT INTO TABLENAME(COL_NAME1,COLNAME_NAME2,
... )values('VALUE1','VALUE2'...);

or
INSERT INTO TABLENAME(COL_NAME1,COLNAME_NAME2, ... ) (select
COL_NAME1,COLNAME_NAME2, ... FROM SOMETABLE);

Hope that helps.

Be sure to check out the online documentation. It gives the sql syntax that
PostgreSql uses. http://www.postgresql.org/docs/

Julie

----- Original Message -----
From: "sandeep bantia" <s_bantia@yahoo.co.in>
To: <pgsql-novice@postgresql.org>
Sent: Tuesday, May 13, 2003 7:52 AM
Subject: [NOVICE] Query regarding Insert Statement!!!!


Hi everybody,
   This would seem a very fundamental doubt to you all
and might've been addressed before too, but I couldn't
find it on the mailing lists, so had to put on the
mailing list.
 My question to all of you is as follows:
 I tried to insert a row into a table of my database
in the following format:
   INSERT INTO TABLENAME SET
(COL_NAME1='VALUE1',COLNAME_NAME2='VALUE2'...);
but this doesn't seem to work and i get the message
that "parse error at or near set"

   I also tried this query,
INSERT INTO TABLENAME SET values
(COL_NAME1='VALUE1',COLNAME_NAME2='VALUE2'...);
but this too doesn't work!!!
I think this type of insert statement is supported in
MySQL,but not very sure about PostGreSQL.

I use postgresql7.2.3 on linux.

Please do reply to my query.
Thanks in advance.
Sandeep!!!

________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly


pgsql-novice by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: Problems with join (no such attribute, but it exists)
Next
From: Nabil Sayegh
Date:
Subject: Re: SELECT across multiple db