RE: Elegant way to insert of some value in some tables in short instruction

From: David Raymond <David(dot)Raymond(at)tomtom(dot)com>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: RE: Elegant way to insert of some value in some tables in short instruction
Date: 2019-03-13 19:25:55
Message-ID: VI1PR07MB579286308FF34E5E36254F55874A0@VI1PR07MB5792.eurprd07.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Short version is when using insert with values you can put a bunch of new records into the SAME table like this...

insert into table1 values (1, 'One'), (2, 'Two'), (3, 'Three');

...but inserts into different tables need to be done in different statements.

-----Original Message-----
From: philolilou [mailto:philolilou(at)free(dot)fr]
Sent: Wednesday, March 13, 2019 3:04 PM
To: pgsql-novice(at)postgresql(dot)org
Subject: Elegant way to insert of some value in some tables in short instruction

Hi all,

i'm very novice in SQL and try to find an elegant way to insert some
values to some tables (that i'll later query with jointure for have a
view of only desired informations) but in short way.

All manuals i saw until now told me like:

insert into table1 values('value1','value2','value3');

insert into table2 values('value1','value2','value3');

Well, it's nice but doesn't it exists a way to make same in 1 operation?

Thanks for your answer

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tomer Praizler 2019-03-13 20:52:45 Parallel Aggregates for string_agg and array_agg
Previous Message philolilou 2019-03-13 19:03:57 Elegant way to insert of some value in some tables in short instruction