All lessons in Software Engineering: Programs, Systems, and Maintainable Software
Relational Modeling and Database Constraints
Represent titles, copies, members, and loans with keys and enforceable relationships.
40 minutes · Members lesson · preview
What you will learn
- Map domain identities and relationships into tables and keys.
- Enforce row-local and cross-row rules at the appropriate database boundary.
- Identify update anomalies caused by duplicated facts.
A spreadsheet row stores a member name, book title, copy barcode, borrowing date, and return date. It is convenient for one report, but correcting a title requires editing many rows, and two spellings of the same member can appear to represent different people. A relational model separates independently maintained facts and reconnects them through keys.
The goal is not the largest number of tables. It is a representation that preserves identity, makes relationships explicit, and gives the database enough information to reject invalid records.