4 min read

Entity

A ‘thing’ or an ‘object’ that is distinguishable from all the other objects. Each entity has a set of properties. For example, each person in an enterprise is an entity with properties person-id, name,age etc.

Entity Set

Set of entities of the same type that share the same properties or attributes. For example, employees of a store.Attributes maybe single or multi-valued, simple or composite,derived.

Relationship

Is an association among several entities. For example,a car is owned by a person. Relationships can be recursive. For example, a student helps a student. Both belong to the same entity set of students. Relationships can have descriptive attributes. For example, the relationship ‘car owned by a person’ can have attribute ‘since’.

Relationship Set

Set of relationships of the same type. For example, a relationship set of ‘owns’ between two entities, owners and cars. Relationships can have mapping cardinality i.e. they can be one to one, many to one, one to many and many to many.Entity sets can have full participation or partial participation in a relationship. The participation of an entity set E in a relationship set R is said to be full if every entity in E participates in at least one relationship in R. If only some entities in E participate in relationships in R, the participation of entity set E in relationship R is said to be partial.

Keys

A key is a set of attributes whose values allow us to uniquely distinguish entities from each other.

SuperKey

K is a superkey of R if values for K are sufficient to identify a unique tuple of each possible relation r(R)

Candidate Key

Superkey K is a candidate key if K is minimal i.e. it has the least number of attributes possible.

Primary Key

One of the candidate keys is selected to be the primary key.

Relationships can involve multiple entities. For example, a
professor guides a student for multiple projects.

Design of ER Diagrams

Notations:

RectanglesRepresent entity sets
EllipsesRepresent attributes
DiamondsRepresent relationship sets
LinesLink attributes to entity sets and entity sets to
relationship sets
Double ellipsesRepresent multi-valued attributes
Dashed ellipsesDenote derived attributes
Double linesIndicate total participation of an entity in a
relationship set
Double rectanglesRepresent weak entity sets

A Simple ER Diagram Construction

Consider an Entity relationship diagram that consists of two entities called customer and loan related through a binary relationship called borrower. The attributes associated with the customer are customer-id, customer-name, customer-street and customer-city. The attributes associated with loan are loan-number and amount. Attributes of an entity set that are members of primary key must be underlined.

Directed Line

A directed line (→) from a relationship set towards an entity set also indicates a key constraint i.e. it specifies that the relationship is either a one-to-one or many-to-one relationship set from the first entity to the entity directed by the arrow.

Undirected Line

An undirected line (—) from the relationship set to the entity set specifies that the relationship is either a many-to-many or one-to-many relationship set from the first entity to the directed entity.

ER Diagram corresponding to customers and loans

Here, the relationship borrower may be a many to many or a one-to-many relationship from customer to loan as it is connected without an arrow. The ‘Customer-id’ is the primary key that uniquely identifies the entities of the set ‘customer’ and the ‘Loan-number’ is the primary key that uniquely identifies the entities of the set ‘loan’.

ER diagram indicating a one to one relationship between ‘customer’ and ‘loan’ entities.

0
Categories: Uncategorized

Vishal Sharma

Currently pursuing a Computer Science degree from G.B Pant Government Engineering college, New Delhi. I am from freshybuilt team.

0 Comments

Leave a Reply