We may tag a question with multiple tags in StackOverflow website, I'm wondering how to find out the most related questions with common tags.
Assume we have 100 questions in a database, each question has several tags. Let's say user is browsing a specific question, and we want to make the system to display the related questions on the page. The criteria for related question is they have most common tags.
For example: Question 1 is tagged with AAA, BBB, CCC, DDD, EEE.
Question 2 is top 1 related because it also has all those 5 tags. Question 3 is top 2 related because it has only 4 or 3 tags that Questio1 has. ......
So my question is how to design the database and find out the questions that's related to Question 1 quickly. Thank you very much.