I am new in SQL and I have a very basic question.
In a SQL table having multiple FK pointing to the same foreign table, is it possible to create a constraint that imposes rules between the FK?
Here's an example of what I am trying to do :
The table 1 contains names and gender of a group of people NAME(PK), GENDER
The table 2 associates a group of 4 people to a room number. ROOM(PK), NAME (FK), NAME(FK), NAME(FK), NAME(FK)
How can constraint the FK in the second table to insure that only person of the same gender are associated to a room?
Is there a better way to deal with such scenario?
Thank you.