Entity Relation Model
Entity Relation Model
An entity is a single person, place or things about which data can be stored. Each entity is
made up of a number of attributes. An attribute describes the facts, details or characteristics
of an entity. For example, CUSTOMER is an Entity while CUSTOMER ID, FIRST NAME,
SURNAME, ADDRESS and PHONE NUMBER are the attributes for the entity CUSTOMER.
Constraints are user-define structures that let you restrict the behaviours of columns in a
table. A relationship describes an association among entities. Recursive relationship is one in
which an entity is related to itself. ER modelling is based on two concepts:
1. Entities, that is, things. E.g. Mr. KUFORIJI Course Database System.
2. Relationships, that is, associations or interactions between entities.
E.g. Mr. Kuforiji teaches course Database Systems
An Entity Set is a collection of entities of an entity type at a point of time. In ER diagrams, an
entity type is represented by a name in a box.
E1
Entity set E2 EMPLOYEE
E3
En
TYPES OF ENTITIES
1. INDEPENDENT ENTITIES: Also referred to as Kernels. They are the backbone of
database. These are what other tables are based on. They are STRONG ENTITIES that is If an
entity can exist apart from all of its related entities (it is existence- independent), then that
entity is referred to as a strong entity or regular entity. Kernels have the following
characteristics:
(a) They are the ‘building blocks’ of a database
(b) The primary key may be simple or composite
(c) The primary key is not a foreign key
(d) They do not depend on another entity for their existence
Example: Customer table, Employee table, Product table
2. DEPENDENT ENTITIES: Also referred to as derived. They depend on other tables for their
meaning.
1
Dependent entities are used to connect two kernels together. They are WEAK ENTITIES. A
weak entity is one that meets two conditions:
i. The entity is existence-dependent; that is, it cannot exist without the entity with which it has
a relationship.
ii. The entity has a primary key that is partially or totally derived from the parent entity in the
relationship.
3. CHARACTERISTIC ENTITIES: They provide more information about another table. These
entities have the following characteristic.
(a) They represent multi-valued attributes.
(b) They describe other entities.
(c) They typically have a one to many relationship.
(d) The foreign key is used to further identify the characterized table.
4. ASSOCIATIVE (COMPOSITE) ENTITIES: The associative entity is used to implement a
M:N relationship between two or more entities. This associative entity (also known as a
composite or bridge entity) is composed of the primary keys of each of the entities to be
connected.
TYPES OF ATTRIBUTES
1. Simple attributes: These are attributes that are drawn from the atomic value domains
e.g. Name = {John} ; Age = {23} , also called Single valued.
2. Composite attributes: Attributes that consist of a hierarchy of attributes
e.g. Address may consists of “Number”, “Street” and “Suburb” → Address = {59 + ‘Meek
Street’ + ‘Kingsford’}
3. Multivalued attributes: Attributes that have a set of values for each entity
e.g. Degrees of a person: ‘ BSc’ , ‘MIT’, ‘PhD’ Source: http://cnx.org/content/m28250/latest/
4. Derived attributes: Attributes contain values that are calculated from other attributes
e.g. Age can be derived from attribute DateOfBirth. In this situation, DateOfBirth might be
called Stored Attribute.
WEAK ENTITY
COMPOSITE ATTRIBUTE
WEAK ENTITY
EMPLOYEE EMPLOYEE
(2) ATTRIBUTE
ADDRES
NAME S
STUDENT
id AGE
3
KEY ATTRIBUTE
ADDRES
NAME
S
STUDENT
id AGE
COMPOSITE ATTRIBUTE
ADDRES
S
NAME
NAME NAME
(3) RELATIONSHIP
TEACHE STUDENT
TEACHER S
BINARY RELATIONSHIP
(a) ONE TO ONE
STUDENT 1 ENRO 1 COURSE
LL
STUDENTS
N ENRO 1 COURSE
LL
4
(d) MANY TO MANY
RECURSIVE RELATIONSHIP
EMPLOYEE