So I have a "posts" table, and I want to associate "tags" with each post. (Similar to Topic Tags, like on this board).
Later on, users can click on a tag, and all related "posts" (i.e. with the same tag) will be displayed.
What's the best/easy way to implement this? (okay, maybe the best way ain't the easy way?)
Here's what I'm thinking.
Create a "tags" table, containing post_id and tag field.
Associate the "tags" table to my "posts" table.
On the web form, user will enter all the tags in one text field.
I parse this field, and split it up using the "," as the delimeter.
Loop, store each tag found into the "tags" table.
No need to create a separate "tags" table.
Add a "tag" string field in my "posts" table.
On the web form, user will enter all the tags in one text field. Store this text field directly to "posts" table.
Use SQL LIKE or CONTAINS to do queries on the "tag" field.
How would you do it? Is there another more efficient way?