If I have a join table with two columns, TeamA and TeamB, how can I guarantee that each pair is unique?
Obviously, I can put a unique unique index in these columns, but this will ensure uniqueness in order A, B, but not B, A right?
TeamA | TeamB
-------------
red | blue
pink | blue
blue | red
As you can see, Red vs. Blue was already indicated as the first entry, and then again indicated as the last. This should be illegal as they will already collide with each other.
Edit: Is there also a way to process SELECT code? Or UPDATE? REMOVE? Etc ..
The idea of ββthe βHome or Guestsβ team, which may be important here, was also raised. This initial concept came to me, thinking about how to create bracketing on the side of the database.