Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

ON DUPLICATE KEY UPDATE for postgres

INSERT INTO the_table (id, column_1, column_2) 
VALUES (1, 'A', 'X'), (2, 'B', 'Y'), (3, 'C', 'Z')
ON CONFLICT (id) DO UPDATE 
  SET column_1 = excluded.column_1, 
      column_2 = excluded.column_2;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ON #DUPLICATE #KEY #UPDATE #postgres
ADD COMMENT
Topic
Name
6+5 =