0
Completed

Multiple foreign key problem - 3NF

emre60ygt 5 years ago updated by Support 5 years ago 3

Hi, Let's say you have 3 tables A, B and C. B inherits from A and uses A.id as a foreign key. Then, C inherits from B and uses B.id as a foreign key. However, sql dbm interface adds A.id and B.id to C as a foreign keys. In this case, I just want to have a relationship between B and C and just B.id as a foreign key in C. No need for A.id in C. I can reach A through B from C. I think this also violates 3NF rule.

table A{

id

}

table B{

id PK

a_id FK

}

table C{

id PK

b_id FK

a_id FK --> this should be an option in a relationship not compulsory

}

Answer

+1
Answer
Completed

Dear User,

Please take a look at following shared project, which shows how to achieve the scenario you mentioned:

https://app.sqldbm.com/SQLServer/Share/llYkWU8ge5X6nP_32jCXWkGFrngIE8md_DYjF4jNYw0


Thanks,

Team - SqlDBM

+1
Under review

Thank you for feedback, we will review this ticket soon

Thank you for your assistance,

SqlDBM Team

+1
Accepted

We will discuss it with our team and work on it, thank you for your assistance

SqlDBM Team

+1
Answer
Completed

Dear User,

Please take a look at following shared project, which shows how to achieve the scenario you mentioned:

https://app.sqldbm.com/SQLServer/Share/llYkWU8ge5X6nP_32jCXWkGFrngIE8md_DYjF4jNYw0


Thanks,

Team - SqlDBM