Under a composite key unique constraint, does EACH value need to be unique (or just the combination)?

StackOverflow https://stackoverflow.com/questions/21233621

문제

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)?

도움이 되었습니까?

해결책

If you have a unique composite key, then only the combination of column values has to be unique.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top