What is the best way to storing and then comparing personality questions? [closed]
I am working on a small dating site for my local area, and I am wondering the best way I can go about storing, retrieving, and then comparing the answers to another person. It wont just be one question, I will be creating over 1000 questions to be more specific on matches. How would I go about doing this?
Here is a database approach:
First, you need a table to hold the questions. It would have an ID column plus another column for the question text.
Then you need a table that holds user information. It would have a lot more columns, but the important one is the user ID.
Then you need a UserAnswer table to hold the users' answers. This table would have a column for user ID, a column for question ID, and a text column to hold the user's answer.
Then, when you want to retrieve a user's answers, you write a query to SELECT the answer text FROM the UserAnswer table WHERE the user ID in that table matches the ID of the user you want.
This is a very simplified version of one way to do this. I am hoping it gives you a general idea of where to start.
精彩评论