Hello!
I have articles on my site, and I would like to add tags which would describe each article, but I'm having problems with design mysql table for tags. I have two ideas:
1) each article would have field "tags", and tags would be in format: "tag1,tag2,tag3"
2) create other table called tags with fields: tag_name, article_id, so when I want tags for article with ID 1, I would run SELECT ... FROM tags WHERE news_id=1;
But, I would also like to know 3 similar articles by comparing tags, so if I have article which has tags "php,mysql,erlang", and 5 articles with tags: "php,mysql", "erlang,ruby", "php erlang", "mysql,erlang,javascript", I would choose 1., 3. and 4., since those 3 have most same tags with main article.
Thanks!