在firebase中使用什么是好的数据库设计?

时间:2016-04-12 20:20:07

标签: android firebase database-design firebase-realtime-database

我正在制作一个Android应用程序,它可以存储一组人在比赛的每场比赛中对待获胜者的预测,并根据整体正确的猜测告诉他们他们的分数以及其他分数。如果我使用基于表的数据库,我会使用以下类型的数据库设计。

Match (Match_id, Team1, Team2, Winner, Timestamp);
Person (Username, Full_name, Password);
Prediction_table (Username, Match_id, Winner_Prediction);

然后我可以使用SQL来查询结果。

但现在我正在使用支持JSON结构的Firebase。哪种数据库设计最适合实现这一目的?

我还考虑了两个数据库设计,但我无法确定哪一个能够正确解决这个问题。

Matches {
Match1: { Person1: Predicted_Team1, ..., PersonM: Predicted_TeamM },
Match2: {...},
...
MatchN: {...}
}

Persons {
Person1: {Match1: Prediction1, ... MatchN: PredictionN},
...
PersonM: {...}
}

0 个答案:

没有答案
相关问题