Lecture 8: Revisiting Entities: ----------------------- Multi-valued attributes Weak entities Example: ------------ Albums have: multiple genres multiple styles multiple userratings multiple similar albums multiple releases (each with year/catalog/format) multiple tracks (each track, 1,2,3,... features one song) Weak Entities ----------------------------- Drawn with a box with two lines around it): A weak entity has a key and a set of attributes. The key of a weak entity is not guaranteed to be unique in the database. A weak entity depends on one of more entities with a many-to-one relationships called supporting entities. The key of all supporting entities combined with the key of the weak entity is guaranteed to be unique in the database. The supporting entities connect to the weak entity by supporting relationships, drawn with two lines around them. Each weak entity and all supporting relationships together are mapped to a new relation. The key of the relation is the combination of the weak entity key and the key of all the supporting entities. Track as weak entity (model 2): Track(AlbumId, TrackNo, duration, notes, songid) Key: AlbumId, TrackNo Track as strong entity (model 1): Track(Id, TrackNo, duration, notes, songid, albumid) Key: Id