Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ChrisTaylorDeveloper/9f990a96a57ff00b46c1ae688e8aeebf to your computer and use it in GitHub Desktop.
Save ChrisTaylorDeveloper/9f990a96a57ff00b46c1ae688e8aeebf to your computer and use it in GitHub Desktop.
SQL identifying vs non identifying relationships.

Non-identifying

Consider books and owners. A book can exist without an owner or change owner. The relationship between a book and owner is non-identifying. The primary key of the parent is included in the child but not as part of the child's primary key.

Identifying

Consider books and chapters. A chapter only exists when a book exists. The relationship between a book and its chapters is an identifying relationship. The primary key of the parent is included in the primary key of the child entity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment