Search code examples
sqldatabasedatabase-designforeign-keys

Is it good practice to duplicate the connections to the grandparent in the parent and son in SQL?


Scheme 1

Scheme 2

I've seen different database designs in different projects. Some of them claim that from son to grandparent one should go through the parent (intuitively correct); in others there is a lot of duplication.

Which is right?


Solution

  • In the Son table, column ParentID also determines GreatParentID. This violates third normal form.

    All else being equal, implementing normal form is a reasonable idea.