Jerry's Blog

Recording what I learned everyday

View on GitHub


24 September 2019

Database(13) -- The Entity/Relationship Model

by Jerry Zhang

Entity Sets

An entity is an abstract object of some sort, and a collection of similar entities forms an entity set.

Attributes

Entity sets have associated attributes, which are properties of the entities in that set.

Relationships

Relationships are connections among two or more entity sets.

Entity-Relationship Diagrams

The arrow pointing to entity set Studios indicates that each movie is owned by at most one studio.

Instances of an E/R Diagram

This set of tuples is called the relationship set for R. However, the “tuples” of a relationship set are not really tuples of a relation, since their components are entites rather than primitive types such as strings or integers.

Multiplicity of Binary E/R Relationships

If a relationship is many-one from entity set E to entity set F, then we place an arrow entering F.

The arrow means “at most one”, it does not guarantee existence of an entity of the set pointed to.

Multiway Relationships

A relationship Contracts that involves a studio, a star, and a movie.

In multiway relationships, an arrow pointing to an entity set E means that if we select one entity from each of the other entity sets in the relationship, those entities are related to at most one entity in E.

Stars and Movies point to Studios. This indicates that for a particular star and movie, there is only one studio with which the star has contracted for that movie. However, there are no arrows pointing to entity sets Stars or Movies. A studio my contract with several stars for a movie, and a star may contract with one studio for more than one movie.

tags: Database