I'm having difficulty finding an answer because I'm having difficulty expressing the question. So I apologize if their is a duplicate (or similar) question on here.
Is there a way to limit the number of references to a specific foreign key in MySQL?
Explained via Metaphor:
Imagine it as a study group with a 'leader'. You have a 'leaders' table, and you have a 'members' table.
Is there a way to prevent each 'leader' from having more than 'x number' of 'members' assigned to them via foreign key?
Or is this something I would have to do when creating the 'members' in the first place? ie. some way to check how many references already exist and change the foreign key if the ID is > 'x number'
Thank you for any help or direction you can give!