Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 21

Session 3

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 1
Agenda:

 ER MODEL
 Notation used in ER Diagram
 Constraints
 Types

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED
E-R MODEL
• The Entity-Relationship (ER) model was originally proposed by Peter in 1976.

• The ER model is a conceptual data model that views the real world as entities and relationships.

• Entity: Any thing that may have an independent existence and about which we intend to collect
data.

Entity instance: a particular member of the entity type e.g. a particular student

Attributes: Properties/characteristics that describe entities


Relationships: Associations between entities
• A basic component of the model is the Entity-Relationship diagram.

• E-R diagram: This is used to visually represent data objects.

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 3
ER Modeling -Notations

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 4
DOMAIN
Domain:

The set of possible values for an attribute is called the domain of the attribute.

Ex:

• The domain of attribute marital status is just the four values: single, married,
divorced, widowed.

• The domain of the attribute month is the 12 values ranging from January to
December.

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 5
ATTRIBUTE AND IT’S TYPES
ATTRIBUTE: It is a property or characteristic of an entity.

Ex: empno is an attribute in emp entity


TYPES OF ATTRIBUTE:

• Key attribute

• Composite key attribute

• Multivalued attribute

• Derived attribute

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 6
Types of Attributes
• KEY ATTRIBUTE: The attribute (or combination of attributes) that is unique for every entity
instance.

Ex: The account number of an account, the employee id of an employee etc.


• COMPOSITE KEY ATTRIBUTE: If the key consists of two or more attributes in
combination, it is called a composite key.
Ex: date of joining is split into date, month, year.

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 7
• MULTIVALUED ATTRIBUTE:
An attribute having more than one value is called multivalued attribute.
Ex: skill set of an employee or hobbies of a student.

• DERIVED ATTRIBUTE: Attribute that can be calculated based on other


attributes
• Ex: years of service of employee can be calculated from date of joining and
current date

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 8
Examples on types of Attributes

Attributes

DOB
Name Address

Empno Employee Designation

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 9
Key attribute
DOB
Name Address

Empno Designation
Employee

The key attribute


is underlined

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 10
Composite attribute

floor building

DOB
Name Address

Empno Designation
Employee

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 11
Multivalued Attribute
DOB
Address
Name

Designation
Empno Employee

skill set

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 12
Single Vs Multi-valued Attributes

• Single valued : can take on only a single value for each entity instance

E.g. age of employee. There can be only one value for this

• Multi-valued: can take many values

E.g. skill set of employee

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 13
Stored Vs Derived attribute

• Stored Attribute: Attribute that need to be stored permanently.

• E.g. name of an employee

• Derived Attribute: Attribute that can be calculated based on other attributes

• E.g. : years of service of employee can be calculated from date of joining and
current date

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 14
Regular Vs. Weak entity type
• Regular Entity: Entity that has its own key attribute.

E.g.: Employee, student ,customer, policy holder etc.

• Weak entity: Entity that depends on other entity for its existence and doesn’t have key
attribute of its own.

E.g. : spouse of employee

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 15
Weak entity

Empno id name

1 has N dependant
Employee

The dependent entity is represented by a double lined rectangle and the identifying

relationship by a double lined diamond

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 16
Cardinality
• Relationships can have different connectivity

• one-to-one (1:1)

• one-to-many (1:N)

• many-to- One (M:1)

• many-to-many (M:N)

E.g.:

Employee head-of department (1:1)

Lecturer offers course (1:n) assuming a course is taught by a single lecturer

Student enrolls course (m:n)

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 17
Cardinality – One - To - One
P1 C1

P2 C2

P3 C3

P4 C4

Person Chair

One instance of entity type Person is related to one instance of the entity type Chair.

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 18
Cardinality – One -to- Many

E1
O1
E2
O2
E3
O3
E4

E5

Organization Employee

One instance of entity type Organization is related to multiple instances of entity type
Employee

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 19
Cardinality – Many-to-One

E1
D1
E2
D2
E3
D3
E4

E5

Employee Department

Reverse of the One to Many relationship.

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 20
Cardinality – Many-to-Many

S1 C1

S2 C2

S3 C3

S4 C4

Student Course

Multiple instances of one Entity are related to multiple instances of another Entity.

© 2017-18 KL University – The contents of this presentation are an intellectual and copyrighted property of KL University. ALL RIGHTS RESERVED 21

You might also like