Assume you have a relation that needs to somehow reference any (variable) number of different items in another table (by their keys). How would this be achieved?
Assume you have a relation that needs to somehow reference any (variable) number of
Share
For this purpose you would usually have an intermediate table. Here is an example schema
In a schema such as this, The question table contains questions. The tag table contains a list of tags that can be applied to the question (like on this site). And the QuestionTag links the two together, so that a question can be linked to any number of tags. To get a specific questions with it’s tags, you could do the following