Answer the question
In order to leave comments, you need to log in
How to forbid creation of 2 records with any identical from two fields?
How to forbid creation of 2 records with any identical from two fields?
Let me explain
here there are entries
key1 key2
000 000 (identical - impossible)
001 000 (identical key2 - impossible)
000 002 (identical key1 - impossible)
234 012 (and so it is possible)
277 666 (and so it is possible)
Answer the question
In order to leave comments, you need to log in
Creation of records with the same value in one field is blocked by a unique index on this field.
Creation of records where key1 == key2 - can be blocked by a trigger.
Those. in your case, you need to create 2 unique indexes on key1 and key2 and a trigger for adding and changing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question