用户评级的数据库架构
这可能是一个非常简单的问题,但由于某种原因,我无法想出一个我 100% 自信的答案。
我正在为自己和几个朋友建立一个有关奥斯卡的小网站。我有一张电影表格、一张提名表格、一张奖项表格(例如最佳影片)、一张表格仪式本身(例如举办年份等)以及将所有仪式链接起来的表格:提名。
提名表看起来(可以预见)如下所示:
NominationID * 胶片ID 奖项ID 提名人ID 仪式ID
我现在要整理一个用户表,但我想不出存储这些数据的好地方:
- 用户对给定电影的评分和/或...
- 是否用户看过给定的电影
- 用户对获奖提名的预测
对于前两个,我正在考虑一个 UsersFilms 表,它看起来像这样:
UsersFilmsID * 胶片ID 用户身份 用户评分 UserSeenIt(布尔值)
对于第三个,预测表:
预测 ID * 提名ID 用户身份
有人可以就这是否是一个好方法提供建议吗?谢谢!
This is probably a really simple question, but for some reason I can't think of an answer I feel 100% confident with.
I'm putting together a little website about the Oscars for myself and a few friends. I have a table for the Films, a table for the Nominees, a table for the Awards (e.g. Best Film), a table for the Ceremony itself (e.g. year it was held, etc.) and a table that links them all: Nominations.
The Nominations table looks (predictably) like this:
NominationID * FilmID AwardID NomineeID CeremonyID
I'm now going to put together a Users table, but I can't think of a good place to store data on these things:
- A user's rating of a given film and/or...
- Whether the user has seen a given film
- A user's prediction of a winning nomination
For the first two, I was thinking of a UsersFilms table, which would look something like this:
UsersFilmsID * FilmID UserID UserRating UserSeenIt (boolean)
For the third, a Predictions table:
PredictionsID * NominationID UserID
Cany anyone give advice on whether this is a good way to do it? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您打算如何处理提名可以是个人或电影的事实?
你打算拯救获胜者吗?
我认为您应该发布您计划为每个表设置的列。我正在考虑很多潜在的问题,但也许您已经全部解决了;)
对于 UsersFilm,由于我怀疑用户可以在观看电影之前对其进行评分,所以我认为布尔值不是强制性的,因为在我看来这永远是真的。
总而言之,我认为数据库建模问题并不简单,总是有很多不同的思考方式,没有人可以说“这个解决方案在每种情况下都有效”。
How did you plan to manage the fact that a nomination can be either a person or a film ?
Did you plan on saving the winners ?
I think you should post the columns you were planning to have for each Table. There's a lot of potential problems I'm thinking about, but maybe you got them all resolved already ;)
For the UsersFilm, since I doubt an user can rate a film prior to seeing it, I don't think the boolean is mandatory, for in my view it will always be true.
And to conclude, I don't think a database modelisation problem can be simple, there's always many different ways to do think and nobodby can ever say "This solution would work in each case".