开发者

Relational database design:two 1 to many relations

I have i table users (id,name) and operations (id,date,id_user,id_target_user)

if i didn't have the id_target_user column I'll just make on relation from the users.id to operations.id_user (every user can have multiple several operations) but the problem is the operat开发者_如何学JAVAion maybe related to another user

how to solve this? i can't create 2 relations on the same key can i?


Yes you can.

  • id_user is a foreign key to users.id.

  • id_target_user is a foreign key to users.id.

That's all you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜