Обсуждение: newbie sql question...

Поиск
Список
Период
Сортировка

newbie sql question...

От
Jason Ziegler
Дата:
Hello folks, I'm new to this list, and have been putting up with mysql
for too long, so please forgive me for asking such a newbie question as
this:

I have a query that works in mysql:
"INSERT INTO table1 ( id, column2, column3 ) VALUES ( '1', 'text
stuff', 'text stuff' ), ( '2', 'more text', 'even more text')"

When I try this in postgresql, it won't work:
"INSERT INTO table1 ( 'id', 'column2', 'column3' ) VALUES ( '1', 'text
stuff', 'text stuff' ), ( '2', 'more text', 'even more text')"

I think I'm getting the syntax wrong for stringing together multiple
value sets or something.
Can anyone point me in the correct direction of how to do this
properly, please?

Thanks,

jz


Re: newbie sql question...

От
Jean-Christian Imbeault
Дата:
Wow, talk about delayed mail ... this was posted and answered a week ago
:) Guess this email had a stopover somewhere on the Internet or has been
wandering aimlessly on for a bit before deciding to make it's way to the
mailing list ...

Jean-Christian Imbeault

Jason Ziegler wrote:
> Hello folks, I'm new to this list, and have been putting up with mysql
> for too long, so please forgive me for asking such a newbie question as
> this:
>
> I have a query that works in mysql:
> "INSERT INTO table1 ( id, column2, column3 ) VALUES ( '1', 'text stuff',
> 'text stuff' ), ( '2', 'more text', 'even more text')"
>
> When I try this in postgresql, it won't work:
> "INSERT INTO table1 ( 'id', 'column2', 'column3' ) VALUES ( '1', 'text
> stuff', 'text stuff' ), ( '2', 'more text', 'even more text')"
>
> I think I'm getting the syntax wrong for stringing together multiple
> value sets or something.
> Can anyone point me in the correct direction of how to do this properly,
> please?
>
> Thanks,
>
> jz
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>


--

Jean-Christian Imbeault


Re: newbie sql question...

От
Jonathan Gardner
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 25 May 2003 22:09, Jason Ziegler wrote:
> Hello folks, I'm new to this list, and have been putting up with mysql
> for too long, so please forgive me for asking such a newbie question as
> this:
>
> I have a query that works in mysql:
> "INSERT INTO table1 ( id, column2, column3 ) VALUES ( '1', 'text
> stuff', 'text stuff' ), ( '2', 'more text', 'even more text')"
>
> When I try this in postgresql, it won't work:
> "INSERT INTO table1 ( 'id', 'column2', 'column3' ) VALUES ( '1', 'text
> stuff', 'text stuff' ), ( '2', 'more text', 'even more text')"
>
> I think I'm getting the syntax wrong for stringing together multiple
> value sets or something.
> Can anyone point me in the correct direction of how to do this
> properly, please?
>

If you take a peek at the INSERT documentation, you'll notice that the syntax
is invalid. You can find documentation on all of the SQL commands in the
fifth book -- "PostgreSQL 7.3.2 Reference Manual" that is including with the
PostgreSQL documentation.

- --
Jonathan Gardner <jgardner@jonathangardner.net>
(was jgardn@alumni.washington.edu)
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+3hCVWgwF3QvpWNwRAg0IAJ9PBoIDI2NnPcY1CH/ImxR1w3j9IgCfQqrb
8zEi8lWJN5EATfex+xInt9I=
=VHDc
-----END PGP SIGNATURE-----