RE: Elegant way to insert of some value in some tables in shortinstruction - Mailing list pgsql-novice

From David Raymond
Subject RE: Elegant way to insert of some value in some tables in shortinstruction
Date
Msg-id VI1PR07MB579286308FF34E5E36254F55874A0@VI1PR07MB5792.eurprd07.prod.outlook.com
Whole thread Raw
In response to Elegant way to insert of some value in some tables in shortinstruction  (philolilou <philolilou@free.fr>)
Responses Re: Elegant way to insert of some value in some tables in shortinstruction  (Andreas Kretschmer <andreas@a-kretschmer.de>)
List 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@free.fr] 
Sent: Wednesday, March 13, 2019 3:04 PM
To: pgsql-novice@postgresql.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



pgsql-novice by date:

Previous
From: philolilou
Date:
Subject: Elegant way to insert of some value in some tables in shortinstruction
Next
From: Tomer Praizler
Date:
Subject: Parallel Aggregates for string_agg and array_agg