Sunday, 25 September 2022

Postgresql - Compare two tables and identify & change rows

 INSERT INTO target 

    (id, name, location, flag,ad_org_id)

    (

        SELECT 

            s.id, s.name, s.location, s.flag,s.ad_org_id 

        FROM source s

    

ON CONFLICT (id,ad_org_id) 

DO UPDATE

SET 

name = excluded.name,

location = excluded.location,

flag=excluded.flag ;

No comments:

Snowflake - Cost Optimization

Reduce auto-suspend to 60 seconds Reduce virtual warehouse size Ensure minimum clusters are set to 1 Consolidate warehouses Separate warehou...