Answers for "postgresql on duplicate key update"

SQL
0

create duplicate table postgres

create table dupe_users as (select * from users);

-- The `with no data` here means structure only, no actual rows
create table dupe_users as (select * from users) with no data;
Posted by: Guest on September-02-2021
0

To ignore duplicate keys during 'copy from' in postgresql

create temp table tmp_table on commit drop as select * from brand with no data;
copy tmp_table (name,slug) from '/var/lib/postgresql/data/Brands.csv' DELIMITER ',' csv header;
insert into brand select distinct on (slug) * from tmp_table;
Posted by: Guest on March-30-2021

Code answers related to "postgresql on duplicate key update"

Code answers related to "SQL"

Browse Popular Code Answers by Language