323,387 views
39 votes
39 votes
When implementing a 1:1 relationship, where should you place the foreign key if one side is mandatory and one side is optional? Should the foreign key be mandatory or optional?

User Psoares
by
3.6k points

1 Answer

8 votes
8 votes

Answer:

When implementing a 1:1 relationship, the foreign key should be placed on the optional side if one side is mandatory and one side is optional.

When this is implemented, the foreign key should be made mandatory.

Step-by-step explanation:

A foreign key (FK) is a primary key (PK) in relational databases. It is used to establish a relationship with a table that has the same attribute with another table in the database. A mandatory relationship exists when the foreign key depends on the parent (primary key) and cannot exist without the parent. A one-to-one relationship exists when one row in a data table may be linked with only one row in another data table.

User Evert
by
2.9k points