Website database structure - best and most efficient structure
One of the basics of this new website I am making it that it allows for a user to select their favourite game. Because i want users to be able to search for people who like the same games that they like, I want the spellings and layouts of each game to be the same so I was thinking of simply having a drop down menu for this. But here's where my data structure issue comes in:
As each user will only have one favourite game, should I just have one table for the users where the 'Favourite Game' field is included? OR, should I have a Users table, and a Games table with a link t开发者_StackOverflow社区able in-between which stores the ID of the User and the ID of the game?
If I were to have other options such as favourite genre too, would this be an efficient way of doing it? I just feel that at the end I'll end up with a huge flat file database, but this seems to be the best way and it'd be easier to create forms for it.
Thoughts?
If the relationship is, and will always be, one favorite per user, then just add the column to the Users table. If you suspect that at any point you may want your users to be able to select more than one favorite, then implement the link table now.
精彩评论