简体   繁体   中英

database design for user rating

i'm building a user rating system to rate transactions between users. these are the tables i currently have.

user                
user_id  username   email       

rating              
rating_id   date    score   review  user_id

review              
review_id   user_id  rating_id

i'm not understanding how i would display the ratings for the users since i would be pulling the usernames from the same table.. do i create another table for reviewers or reviewed?

Your user_id is the primary key for User table. In your query, use a join on user_id to get the other fields from other tables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM