POV
POV

Reputation: 12025

What is type of relationship between tables?

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

Answers (3)

Jake Wagner
Jake Wagner

Reputation: 826

Recipients.ID has many to one relationship with the Orders.ID.

Upvotes: 1

GolezTrol
GolezTrol

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

FridmanChan
FridmanChan

Reputation: 130

I think its one-to-many relationship

Upvotes: 1

Related Questions