I am trying to understand better 1-1 vs 1-0..1 relationship.
Let's say I have a Car, SteeringWheel, and Sunroof
- 1 Car must have 1 SteeringWheel and 1 SteeringWheel must belong to 1 Car; therefore this is 1:1 relationship
- 1 Car can have 0 or 1 Sunroof and a Sanroof must belong to 1 Car; therefore this is 0..1:1 relationship.
But in terms of entities, I am not sure how to implement 0..1:1 relationship.
Below is 1:1 relationship btw Car and Sunroof but it should be 1:0..1.
How to make it 1:0..1 relationship?
-------------- ONE TO ONE --------------
CAR SUNROOF
--------------- -------------
CarId PK -1----+ SunroofId
Model | Diameter
Year +--0..1- CarId FK, UNIQUE