Er Modeling

The E-R (entity-relationship) data model views the real world as a set of basic objects (entities) and
relationships among these objects.

# Entities

An entity is an object that exists and is distinguishable from other objects. For instance, John Harris with
S.I.N. 890-12-3456 is an entity, as he can be uniquely identified as one particular person in the universe.

An entity is represented by a set of attributes. E.g. name, S.I.N., street, city for customer entity.

An entity set is a collection of similar entities. All entities in an entity set have the same set
of attributes.

The domain of the attribute is the set of permitted values (e.g. the telephone number must be seven
positive integers).

## Weak Entities

A weak entity can be identified uniquely only by considering the primary key of another (owner) entity. Owner entity set and weak entity set must participate in a one-to-many relationship set (one owner, many weak entities). It must use a foreign key in conjunction with its attributes to create a primary key. The foreign key is typically a primary key of an entity it is related to.
Weak entity set must have total participation in this identifying relationship set.

# Relationships

A relationship is an association between several entities. For example, consider the two entity sets customer and account.We define the relationship CustAcct to denote the association between customers and their accounts.

# Attributes

It is possible to define a set of entities and the relationships among them in a number of different ways. The main difference is in how we deal with attributes.

The question of what constitutes an entity and what constitutes an attribute depends mainly on the structure of the real world situation being modeled, and the semantics associated with the attribute in question.

# Mapping Constraints

An E-R scheme may define certain constraints to which the contents of a database must conform.

## Mapping

Binary relationship sets between entity sets A and B must be one of:

1. one-to-one
2. one-to-many
3. many-to-one
4. many-to-many