If data exists, do nothing (don’t INSERT)
INSERT INTO customers ("name", "email") VALUES('Microsoft','hotline@microsoft.com') ON CONFLICT ("name") DO NOTHING;
If name column has same data, do nothing
If data exists, UPDATE row
INSERT INTO customers ("name", "email") VALUES('Microsoft','hotline@microsoft.com') ON CONFLICT ("name") DO UPDATE SET "email" = EXCLUDED.email || ';' || customers.email;
Before
After
Leave a Reply