I am building a Q&A website. For each Question there are several tags. Which is the best database model for this use case? Please tell me of the current options:
Option 1:
QuestionTable (one) → QuestionTag (many tags), and another field of type Question (multiple for each Tag).
I can see the problem in this model that there maybe millions of #tags and for each tag millions of questions in each entry for QuestionTag table. Isn’t this going to blow my database app when it scales?
Option 2
QuestionTable (one) → QuestionTag (one), there is field of type text (Tag) with multiple values. So for each QuestionID, there will be multiple tags in the same database record.
I am currently going with Option 2, but facing a technical problem where the list of texts (tags) are not seen as separate entities when seen from a dropdown list. I have tried checking on the forum for this problem in this inquiry but still it’s not clear how I can do it.
So as you can see in this image the list of texts are shown on the same line in the dropdown list.
Appreciate your knowledge to learn 2 things:
- Which DB model option is best, 1 or 2?
- If I go with option 2, how do I separate list of texts to be one entry for each line?