Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLupserts ON CONFLICT MERGESingle-choice MCQ

In an INSERT ... ON CONFLICT (id) DO UPDATE, how do you reference the value that the failed insert tried to provide, versus the value already in the table?

INSERT INTO counters (id, hits) VALUES (1, 5) ON CONFLICT (id) DO UPDATE SET hits = ??? ; -- goal: add the proposed 5 to the existing hits