Announcements#
Exam #1 on next monday
It will cover everything we did in class, including on this week thursday
Open book open notes, bring any printed material with you (within reason)
You may not use anything electronic, including your phone, ipad, remarkable, computer and whatever other device I forgot.
You may not write on your cribsheets during the exam, only your exam papers.
Lecture exercise #9 out today, due on saturday midnight
Hw#2 is due thursday at midnight
You can use draw.io for draw ER Diagrams# Code
Mapping an ER Diagram to the relational data model#
Map all entities to a relation, the key of the entity becomes the key of the relation
Relationships:
One to many: store it as an attribute on the many side by including the key for the entity on the one side in the other entity
One to one: same as the one side of one to many, but can do in either direction
Many to many (at least two N connnections): map to a new relation, take the keys of each of the connecting entities, the key should include all entities connected with a many cardinality
Any attributes of the relationship follows whereever you push the relationship

Ternary (or higher order) relationships#
Note that the cardinalities of relationships indicate a functional dependency.
You can try and see whether the information in a ternary relationship can be captured by a combination of binary relationships, you can use the Chase algorithm.

Weak Entities#
Entities where the key of the entity is not required to be unique to the whole database
Weak entities have one or more supporting entities
Key of a weak entity is its own key combined with the key of all supporting entities
Weak entities by rectangle with double border and relationship that shows supporting entities with a diamond with double borders
When converting a weak entity to relational data model, map the weak entity and the supporting relationship together: the key of the weak entity and the key of all supporting entities together is the key of the new relation
The difference in modeling with weak and strong entities is subtle, mostly about whether it is good to add some new ID attribute and whether to store an additional relation for the strong entity. Either model is generally fine.
