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 tousers.id
.id_target_user
is a foreign key tousers.id
.
That's all you need.
精彩评论