Correct entity relationship diagram representation of a normalized table with a NOT NULL foreign key
0
votes
1
answer
1011
views
## Intro
Hi everyone, this is mainly a classification/theoretical question on the topic of **inheritance** and **normalization** techniques in database design and their appropriate representation in entity relational diagrams. In a practical implementation it doesn't present a challenge as you could just set the attribute in question as **IS NOT NULL** and be done. However for a graphical representation I am a little confused on how to do it correctly.
Here is a github gist link with a interactive **mermaid** diagram representing a hypothetical scenario on a particular example: [gist](https://gist.github.com/papshmeare/dfe4b93e7c829b486f382e78e30c6318)
## Problem
The important part is in this section:

Assume we have an entity called PRODUCT which might have different types of attributes depending on the product in question(eg. Physical product/Digital product). For that reason we introduce two "subtables" whose PKs refer to a PRODUCTs FK attribute **product_type_id**. It is clear that a PRODUCT can only have a singular **product_type_id** but because it can be either **PhysicalProduct** or **DigitalProduct** what kind of relationship do these two "subtables" have with PRODUCT? So far I deduced that it must be **one to (zero or one)** as presented in the graph. That's where the problem(perhaps non-existent) lies.
If we have two **one to (zero or one)** relationships to a mandatory **IS NOT NULL** attribute doesn't it infer a possibility of two **one to zero** relationships visually or is it something not clicking in my head here and that is how it is supposed to be in this kind of scenario?
Asked by papshmeare
(3 rep)
Mar 27, 2023, 10:18 AM
Last activity: Mar 27, 2023, 12:19 PM
Last activity: Mar 27, 2023, 12:19 PM