I am working on a search/tag system. My original query I wrote was for when I was storing 'title', 'description' and a comma seperated 'tags' column in my article/video table. I have since realised the advantage of normalising my tags. I now have three table to deal with...tbl_Articles
- article_id
- title
- description
- content
- tag_id (surrogate primary id)
- tag_type (equals 1 for tbl_Articles,2 for tbl_videos)
- tag_word_id (see table bellow)
- tag_target_id (article_id/video_id -depends on tag_type)
- tag_word_id
- tag_word (finally the actual tag)