我正在开发一个应用程序,两个朋友可以使用它随机选择一个视频游戏互相玩。两位朋友都填写了一份关于他们有兴趣互相玩哪些视频游戏的调查问卷,根据比赛情况,点击按钮后,我想说“今天在'朋友'中播放名人视频游戏屋。”每个用户输入他们的名字,在调查问卷之前,每个朋友都存储在数据库中。
示例问题:
你会玩'朋友'在你家玩游戏吗?
你会在'朋友家'和'朋友'一起玩“使命召唤”吗?
每个朋友回答同样的问题。
现在我有(你的建议不必受此约束):
Users table (id, friendId, FirstName, LastName, Email, dateCreated)
Questions table (id, questionText)
-questionText: "Would you play Call of Duty with 'friend' at 'friends' house?", and "Would you let 'friend' play Call of Duty with at your house?
Answers table (id, answerText)
-answerText would be "Play Call of Duty today at 'friends' house"
Matches table (id, userId, answerId)
-If user 1 says they would let 'friend' play call of duty at their house, and user 2 says they would play call of duty at user 1's house, then need to store answer "Play Call of Duty at user 1's house today"
所以想象一下,你和一位朋友都在用这份调查问卷来确定当天在哪里玩游戏......那么最好的数据库表布局是什么?
答案 0 :(得分:0)
除非您需要完全灵活的问题(完全不遵循上述格式),否则我将废弃""调查"设置,并使用类似的东西:
用户表: UserID,FirstName,LastName,Email,DateCreated
UserFriends表: UserID1,UserID2,DateCreated
游戏桌: GameID,GameName
UserHostingGame表(用于存储表示同意在自己家中主持游戏的人): UserHostingGameID,UserID,GameID,DateCreated
UserGameRequest表: UserGameRequestID,UserID,UserHostingGameID,DateCreated