Search Postgresql Archives

Re: Column names for INSERT with query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 22, 2013 at 6:36 PM, Ian Lawrence Barwick <barwick@xxxxxxxxx> wrote:
INSERT INTO t (t_field1, t_field2, t_field3)
  SELECT r.field1, r.field2, (x+y)
    FROM r

Obligatory link to documentation: http://www.postgresql.org/docs/9.2/static/sql-insert.html. See where it says [ ( column_name [, ...] ) ]? The square brackets mean "optional", and the ",..." means repeat as needed. The fact "column_name" is italics tell you it's some kind of variable text you should replace, and later on in the page explains what goes there. So it's telling you that you can use a comma separated list of column names from the destination table. PostgreSQL has some of the best documentation of any software I've ever seen. Don't hesitate to check it often when working.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux