0% found this document useful (0 votes)
12 views31 pages

Week 2

Uploaded by

setoseto1907
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views31 pages

Week 2

Uploaded by

setoseto1907
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Database Management Systems

Entity-Relationship Models

Pınar Yıldırım
Modeling data in the organization
Entity-Relationship Model
• Entities:
– Person, place, object, event

• Relationship
– Link between entities(corresponds to primary key-foreign key
equivalencies in related tables)

• Attributes
– Properties or characteristics of an entity or relationships
E-R Model
E-R Model
Entity= Employee

Employee Name Address BirthDate


number
642 Michael Pendik 1981
541 Patrick Sarıyer 1952
913 Sevgi Tuzla 992
… … … …

Attribute Attribute data


type
Employee number Number
Name Char(25)
Address Char(30)
BirthDate Date
Composite Attribute
• An attribute that has meaningful component parts.

• Example: The name is broken into component parts (FirstName and


LastName).
Composite Attribute
• Employee address can be broken into strees address, city, state and postal
code.

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Multivalued Attribute

• Multivalued may take more than one value for a given entity.

• Example: Student can have many phone numbers.


Derived Attribute
• Derived values can be calculated from related attribute values( not
pyhsically stored in the database).

• Example: Age is a derived attribute.It can be calculated by using BirthDate.


Identifiers(Keys)
• An attribute (or combination of attributes )that uniquely identifies
individual instances on an entity type.

• Candidate identifier, an attribute that could be a key, satisfies the


requirements for being an identifier.
• Identifier is boldfaced or underlined.
Simple and composite identifiers

Simple Identifier
Simple and composite identifiers

Composite Identifier : (Flight_Number, Date)


Cardinality of Relationships
• One-to-One
– Each entity in the relationship will have exactly one related entity

• One-to-Many
– An entity on one side of the relationship can have many related
entities, but an entity on the other side will have a maximum of one
related entity

• Many-to-Many
– Entities on both sides of the relationship can have many related
entities on the other side
Cardinality of Relationships
Some Examples
E-R Examples
E-R Examples
Basic E-R Notation
Weak Entity
Enhanced E-R Diagrams
• Extends original ER model with new modeling constructs.

• Attribute inheritance
– Subtype entities inherit values of all attributes of the supertype.
Basic notation for supertype/subtype
notation

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Employee supertype with three subtypes

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Generalization and Specialization

• Generalization: The process of defining a more general entity


type from a set of more specialized entity types. BOTTOM-UP.

• Specialization: The process of defining one or more subtypes


of the supertype and forming supertype/subtype
relationships. TOP-DOWN

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Example of Generalization
All these types of vehicles have common attributes.

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Example of Generalization

So we put the shared attributes


in a supertype

Note: no subtype for


motorcycle, since it has no
unique attributes

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Example of Specialization

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Disjoint constraint

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Disjoint constraint
Overlapping

Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson
Education, Inc. Publishing as Prentice Hall
Overlapping
References
• Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh, Heikki
Topi © 2013 Pearson Education, Inc. Publishing as Prentice Hall

• https://www.tutorialspoint.com/dbms/er_diagram_representation.htm

You might also like