I know I can do an:
INSERT INTO MyTable (name, num, dateCreated)
VALUES ( "Joe", 31, "2016-05-01 00:00:10" )
WHERE NOT EXISTS (
SELECT num FROM MyTable WHERE num = 31 AND dateCreated = "2016-05-01 00:00:10"
)
But this is very slow as it uses a sub-query on every insert. Is there a faster way to do this?
Can i add a unique constraint on multiple columns?
I do NOT want to use the primary key to test for duplicate