Enforcing minimal cardinality
- M-O
- Children must have parents.
- Primary key of parent is FK of child.
- Require FK to be not-null
- Implement cascading update/delete
- O-M
- DBMS does not provide much help here.
- Usually this is enforced through the use of triggers
- A trigger is a code module which is invoked when an event (update, delete, create,...) occurs.
- M-M
- Even more restrictive than O-M, so more work to enforce.
- Try to avoid these if you can.
- Chicken-and-Egg problems are common here:
- I can't add a parent because I don't have a child, but I can't add a child because I don't have a parent, but I can't add a parent ...
- Views come into play with these,
- Read the paragraph on 230.
- You should probably read through the case study.