If you want to insert values into a MySQL table, but only if those values don’t already exist, and you don’t want to use a primary key on the table (and deal with the resulting error suppression ), here’s an elegant one-query method of doing so.
INSERT INTO [table name] SELECT ‘[value1]’, ‘[value2]’ FROM DUAL
WHERE NOT […]