Mon, Aug 30, 1999 ------------------------ - Review of E/R Modeling - Multiway Relationships - why do we need them? - notation - Roles in Relationships - when the same entity set appears more than once in the same relationship - Person married to Person (roles: husband, wife) - Person married to Person with Person (child role) - Symmetric Relationships - when for every (a,b), there is also a (b,a) - Example of Symmetric Relationships - Many-Many: Friends (assuming standard laws of the world) - One-One: Married (when the edges are labeled spouse, instead of husband/wife) - Question from Akash: Can a many-one relationship be symmetric? - Answer: No (I incorrectly said "possibly" earlier) - Reasoning: Assume a relationship is many-one from A to B. Example data: (a1,b1), (a2,b1), (a3,b1). If we assume it is symmetric, we should also have the tuples (b1,a1), (b1,a2), (b1,a3) but then, it is many-one in the reverse direction. - Conclusion: Only many-many or one-one can be symmetric - Attributes on Relationships - when something belongs to the relationship rather than either of the entity sets participating in it - Motivation: divorce proceedings etc. :-) - Removing multi-way relationships, roles, and attributes from relationships - use a connecting entity set and introduce new many-one relationships - Sometimes, even the relationship might have "identity" in the real world: - Example: Movies, Actors and Contracts. - Contracts, though a relationship, has meaning as a "thing" in life Wed, Sep 1, 1999 ------------------------ - Review of converting multiway to two-way relationships - Good Design Principles - Be faithful - Avoid redundancy - KISS - Pick the right kind of element (Contracts example) - Inheritance in E/R Modeling - Use triangles to denote ISA links - Entity can belong to more than one entity set simultaneously - Constraints: - Key constraints - use underlines - Referential Integrity (stricter than a -> one constraint) - use a rounded arrow entering the "important" set - works only on two-sets at a time - for more complicated ref. integrity constraints, need to encode it in application - Referential Integrity = -> + "has to exist" - If the "important object" is deleted - delete the "other object" too! - If a new "other object" is introduced - connect it to an existing "important object" - For things un-modellable by E/R - Write "Note: ... " on the margin of the page! :-) Fri, Sep 3, 1999 ------------------------ - Weak Entity Sets - Causes of Weak Sets: - Elimination of Multiway relationships - Hierarchy of Entity Sets - Solution of an University Database Problem (handout provided in class)