SQL - Best practice for a Friendship table

后端 未结 5 1412
青春惊慌失措
青春惊慌失措 2020-12-14 03:58

Before you show me duplicates, please note that I\'ve searched through the site an have found some examples but not quite specific to my prob

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 04:36

    User(UserID) Friendship(User1ID, User2ID, FriendshipStatus)

    Check constraint: User1ID < User2ID

    Unique constraint: User1ID, User2ID

提交回复
热议问题