要求:
1. All "Users" have 5 fixed set of same "Services" which they are supposed to rate.
2. Given the userId, display all the Services and their corresponding "Ratings".
3. Rating would be from a scale of 1 - 5 only
4. Ratings can be updated anytime by the user for any of his Service.我不是SQL/DB专家,我在堆栈中提出了这个问题,我从Raj这里得到了ER Model of User Ratings的答案。
这是ER I的最后定稿(开放供更正)。

My Fetch查询:获取所有服务及其对应的userId (例如userId = 1)
SELECT service.service_id, service.name, usr.ratings
FROM services service,
ratings ratings,
userservices_ratings usr,
user user,
user_services us
where
us.userid = user.uid and
us.serviceid = service.serviceid and
usr.usid = us.id and
usr.rid = ratings.rid and
user.id = 1发布于 2015-12-02 06:14:34
您可以在这里选择分级架构的标准格式,https://schema.org/Rating可以从中选择所需的列。
https://stackoverflow.com/questions/24543479
复制相似问题