Database design: Best table structure for capturing the User/Friend relationship?
问题 I'm trying to design a data model that denotes one user being the friend of another user. This is what i've come up with so far, but it seems clunky, is there a better solution? User ===== Id Name etc... UserFriend =========== UserId FriendId IsMutual IsBlocked 回答1: UserRelationship ==== RelatingUserID RelatedUserID Type[friend, block, etc] Agree that mutuality doesn't belong as a column; breaks normalization. 回答2: To go one record per two users and avoid consuming extra memory that the