Entity-Relationship chapter, Slides of Database Programming

Data Modeling Using the Entity-Relationship (ER) Model

Typology: Slides

2018/2019

Uploaded on 07/06/2019

lito112
lito112 🇯🇴

1 document

1 / 64

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Chapter 7
Chapter 7
Data Modeling Using the Entity-
Relationship (ER) Model
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40

Partial preview of the text

Download Entity-Relationship chapter and more Slides Database Programming in PDF only on Docsity!

Chapter 7

Chapter 7

Data Modeling Using the Entity-

Relationship (ER) Model

Entity Relationship Model (ER)

Entity Relationship Model (ER)

ER model was proposed by

ER model was proposed by Peter Chen

Peter Chen in

in

ER model has become the standard tool for

ER model has become the standard tool for

conceptual schema

conceptual schema design

design

ER model consists of three basic constructs:

ER model consists of three basic constructs:

entities

entities ,

attributes

attributes and

and relationships

relationships .

Entity and Entity Set

Entity and Entity Set

Two types of entities:

Two types of entities:

Strong entity: can exist independently (or

can uniquely identify itself)

Weak entity: existence depends on the

existence of other (strong) entity or

entities

Examples:

Examples:

An employee is a strong entity but the

dependents of the employee could be

weak entities

An account in a bank is a strong entity but

a transaction could be a week entity

Entity and Entity Set

Entity and Entity Set

An

An

entity type

entity type

defines a set of entities that

defines a set of entities that

have the same attributes.

have the same attributes.

STUDENT is an entity type (Schema)

An

An entity set

entity set is a collection of entities of the

is a collection of entities of the

same entity type

same entity type

Examples:

Examples:

Rema, Ali, Amal, Samer, Rana are entity

set of an entity type STUDENT

Types of Attributes

Types of Attributes

Simple

Simple (or

(or atomic

atomic ) attribute is a one which

) attribute is a one which

cannot be divided into smaller parts.

cannot be divided into smaller parts.

Examples:

SSN, GPA, Salary.

Composite

Composite attribute is an attribute which can

attribute is an attribute which can

be divided into smaller subparts, these subparts

be divided into smaller subparts, these subparts

represent more basic attributes with

represent more basic attributes with

independent meanings of their own

independent meanings of their own

Examples:

Name: First_Name, Middle_Name, Last_Name

Address: Street_Address, City, State, Zip code

House No.

Address

Street-Address City

State Post Code

Street Name

An Example of a composite attribute

An Example of a composite attribute

Types of Attributes

Types of Attributes

A

A

stored

stored attribute is a one whose value is

attribute is a one whose value is

explicitly stored in the database.

explicitly stored in the database.

e.g. name, birth-date.

Derived

Derived -attributes: whose values are

-attributes: whose values are

computed from other attributes.

computed from other attributes.

Age from Birthdate

Annual Salary from Monthly Salary

NoOfEmployees ==> Count number of

employees in the Employee table.

Relationship Types

Relationship Types

A relationship type is represented as

A relationship type is represented as diamond-

diamond-

shaped box

shaped box

which is connected by straight lines

which is connected by straight lines

SUPPLIER

PROJECT

PART

supplies

Ternary Relationships

Ternary Relationships

COMPANY

PRODUCT

COUNTRY

Sells

Ternary Relationships

Relationships

Relationships

The

The role name

role name signifies the role that a

signifies the role that a

participating entity from the entity type

participating entity from the entity type

plays in each relationship instance

plays in each relationship instance

entity

entity e

e plays the role of a

plays the role of a supervisor

supervisor , while

, while

entity

entity e

e plays the role of a

plays the role of a supervisee

supervisee

EMPLOYEE

Supervises

supervisor

supervisor

supervisee

supervisee

e

e

e

e

Cardinality Ratio

Cardinality Ratio

Specifies the

Specifies the number

number of

of relationship instances

relationship instances

that an entity can participate in

that an entity can participate in

Common cardinality ratios for

Common cardinality ratios for binary

binary

relationship types are

relationship types are

1:N , and

M:N

DEPARTMENT Has

MANAGER

A department has one manager and a

manager manages one department

EMPLOYEE

Works-on

PROJECT

M N

An employee works on many projects,

and a project has many employees

working on it

M:N

M:N