Sie sind auf Seite 1von 15

Entity Relationship Model

(ER) Model
• Main features
1. It is high level conceptual model

2. It allows us to describe the data involved in a real world enterprise in


terms of objects and their relationships

3. it is used to develop an initial design of a database

4. It provides a set of useful concepts to make it convenient for a


developer to move from a basic set of information to a detailed
and precise description of information that can be easily
implemented in a database system

5. It describes data as a collection of entities and relationships and


attributes
• An example of a database application - college database
A college database keeps a track of
1. Students
2. Faculty
3. Departments
4. Courses -organized by various departments

Following is the description of college database


College contains various departments like
Department of Information Science
Department of Computer Science
Department of Mechanical Engineering
Department of E&C
Each department is assigned a unique id and name. Some faculty members are
also appointed to each department and one of them works as head of the
department
There are various courses conducted by each department . Each
course is assigned unique id , name and duration

• Faculty information contains name , address, department, basic


salary etc., A faculty member is assigned to only one department
but can teach various courses of other department also

• Student’s information contain Roll No (unique) Name, Address . A


student can opt only for one course

• Parent (guardian) information is also kept along with each student.


Guardian’s name, age, sex and address is also maintained
• Entity
An entity is an object of concern used to represent the things in the real world (Car, table, book)
An entity need not be a physical entity , it can also represent a concept in real world also (project, loan)
It represents a class of things , NOT ANY ONE INSTANCES Eg: STUDENT entity has instances of
Ramesh and Mohan
ENTITY SET OR ENTITY TYPE
A collection of a similar kind of entities is called entity set or entity type

In the example of COLLEGE DATABASE objects of concern are


1. Students
2. Faculty
3. Course
4. Departments

Collections of all the students entities form a entity set STUDENT


Collection of all the courses form an entity set COURSE
• ENTITY IDENTIFIER KEY ATTRIBUTES
An entity type has an attribute whose values are distinct
for each individual entity in the collection

Such an attribute is called a key attribute and its values


can be used to identify each entity uniquely

STRONG ENTITY SET


entity types containing a key attribute are called strong
entity types or regular entity types.
Example – student entity has a key attribute RollNo which
uniquely identifies it and hence it is a strong entity.
• ATTRIBUTES
• An attribute is a property used to describe the specific feature of the entity

• To describe an entity a set of attributes is used

• A student entity may be described by the student’s name, age, address, course

• An entity will have a value for each of its attributes

Example :
Rollno:1234
Name :Supriya
Address: B-4, Mayapuri, New Delhi
Course : B.E
• Domains

Each simple attribute of an entity type contains


a possible set of values that can be attached to
it. This is called the domain of the attribute
An attribute cannot contain a value outside the
domain ( for a PERSON entity PERSON_ID has
a specific domain, integer values say 1 to 100)
Types of attributes
• Simple
• Composite
• Single-valued
• Multi valued
• Stored
• Derived
• Simple – The attribute cannot be further divided into smaller parts
and represents the basic meaning is called a simple attribute. ( eg:
‘First Name’, ‘Last Name’, age attributes of a person entity
represent a simple attribute )

• Composite – attributes that can be further divided into smaller


units and each individual unit contains a specific meaning (eg:
NAME attribute of an employee entity can be sub-divided into first
name, middle name, last name)

• Single Valued – attributes that have a single value for a particular


entity . (Age is a single valued attribute of a student entity)
• Multi Valued - attributes that have more than one value for a
particular entity. Different entities may have different number of
values for these kind of attributes.
For multi valued attributes one must also specify the minimum and
maximum number of values that can be attached. (Eg: phone
number of a person is a multi valued attribute)

• Stored attributes that are directly stored in a database. (eg: Birth


Date attribute of a person

• Derived – attributes that are not stored directly but can be derived
from stored attributes are called derived attributes. (eg: years of
services of person can be determined from the current date and the
date of joining of the person.
Relationships
• A relationship can be defined as
A connection or set of associations
Or
A rule for communication among entities

• Eg: in college the database the association between


student and course entity
student opts course – is an example of relationship
• Relationship Sets
A relationships set is a set of
relationships of the same type eg:
consider the relationship between two
entity sets student and course.
Collection of all instances of relationship
opts forms a relationship set called
relationship type.
Degree
• The degree of a relationship type is the number of
participating entity types.

• Relationship between two entity types is called a binary


relationship .

• A relationship among three entities is called ternary


relationship

• Relationship among n-entities is unary relationship

Das könnte Ihnen auch gefallen