I have a question web application which allows users to ask questions on specific things. I am developing a tag style labeling for each question just like stack overflow. When I associate each post with categories or tags, I was wondering what is the best way to store this. Here is what I would guess would be an ideal way to do this:
-Create a column in the sql database to store either a serialized json object or simply just a comma separated line with the IDs of the categories that the question pertains to.
I feel with this approach it will be hard to search questions according to a specific tag because it will have to parse the categories column for each question which seems like it would not be ideal. What is a good way to architect this feature to fit searching well, but also keep the schema fairly simple (keep in mind, my main goal is to make the tags as similar to stackoverflow as possible)?
Well, to keep it simply why not just follow the normalized approach with three tables:
Questiond(QId, name)
Tag (tagId, name)
Tag-per-topic (QId,tagId)
very simple….