Reputation: 12025
I have table Orders
and table Recipients
:
Where Orders
is:
| id | recipient_id
Where Recipients
is:
id | user_id | address_id
So, one order can be assigned to one recipient.
An order has foreign key to Recipients.id
.
By another side, Recipients
can be related to some orders.
What is relationship between table then?
Upvotes: 0
Views: 88
Reputation: 116180
It's a one to many relationship, AKA 1:n relationship.
From https://en.wikipedia.org/wiki/Foreign_key:
Multiple rows in the referencing (or child) table may refer to the same row in the referenced (or parent) table. In this case, the relationship between the two tables is called a one to many relationship between the referenced table and the referencing table.
Upvotes: 1