How would you model the relational data model for the following case?
leader is chosen to lead group
a group is led by one and only one leader
a leader leads 0 to 1 group
This is my solution
Group [GroupID(PK)]
Leader[LeaderID(PK)]
Leads [GroupID(PK), LeaderID(FK)]
But this actually allows many leaders to lead a group.
Thank you. Any input is appreciated.
Well, you could just have
leaderOfas a (unique) field in theLeadertable. If it’sNULL, the leader doesn’t lead any group, and if it’s a number then that number is the ID of the group being led.If you have a
usersorplayerstable somewhere, it might even be better to put thatleaderOffield in that table and drop theLeaderandLeadstables altogether.