Home > Software design >  Check Constraint Equivalent to Partial Unique Index
Check Constraint Equivalent to Partial Unique Index

Time:12-22

I have a column holding some values. I would like to enforce uniqueness for values 1 and 2, but all other values in that column do not need to be unique. I know how to do it with partial unique index. I was wondering if there is a better way. Maybe check constraint?

CodePudding user response:

No, a partial unique index is the way to go. Why look for a second solution if you have a perfectly good one?

  • Related