I need to store this relation:
domain -> tag1, tag2, tag3 .... tagN
to a msql table.
I figured I would just have two fields like this
domain | tag_arary
Actual data might be:
facebook.com | [social, networking, web, foo1, foo2 ]
Or another way, would be to set a maximum amount of tags and just have a field for each tag:
Structure
domain | tag1 | tag2 | tag3
Actual Data
facebook.com | social | networking | web | foo1 | foo2
What is the best way to implement this.
Make note, I’ll need to add tags, and remove tags.
Thanks
This is probably the most flexible way for the long run, as it’s much easier to query/update/delete the tags. You might want to give id to the domains table though, as it would be much faster in terms of searching on integer field.