If you have a unique composite key, then only the combination of column values has to be unique.
Under a composite key unique constraint, does EACH value need to be unique (or just the combination)?
-
30-09-2022 - |
Question
I think this is a very basic question - so basic that I haven't been able to find an answer.
Let's say that two columns compose a composite key unique constraint: col_a
and col_b
.
Can two rows share a common value for col_a
, as long as the combination of values for col_a
and col_b
are different? Or does each column need to be unique (like two separate UNIQUE constraints would require)?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow