If a row does not exists insert else don't insert in postgres If a row does not exists insert else don't insert in postgres sql sql

If a row does not exists insert else don't insert in postgres


I like the solution they mention here

INSERT INTO table (id, field, field2)       SELECT 3, 'C', 'Z'       WHERE NOT EXISTS (SELECT 1 FROM table WHERE id=3);