11
FEN 2014-03-23 1 Conceptual modelling: The Entity-Relation (ER) Model Conceptual models Entity – Relation (ER) models

FEN 2014-03-231 Conceptual modelling: The Entity-Relation (ER) Model Conceptual models Entity – Relation (ER) models

Embed Size (px)

Citation preview

FEN 2014-03-23 1

Conceptual modelling:The Entity-Relation (ER) Model

Conceptual modelsEntity – Relation (ER) models

2

…or…

Where does all the tables come from???

FEN 2014-03-23

3

Conceptual Data Models

A conceptual data model describes the data objects (entities) and their relations in the problem domain.A conceptual model of the data is the basis on which the IT systems of an organisation are based.It should be:

Independent of implementationStable over time

Over time conceptual data structure doesn't change nearly as much as functionality

Conceptual models are to be transformed to a database model as the relational model.

FEN 2014-03-23

4

Example: MiniBank

This is implementation:

FEN 2014-03-23

What would a conceptual model look like?• Entities?• Customer• Account

• Relations:• Customer-Owns-Account

Customer Account

custNo name accNo balance

inRate

Owns1 n

5

Entity-Relation (ER) Model: ConceptsEntities

Attributes⋅ Atomic⋅ Composite⋅ Multi valued

Attribute valuesEntity typesKeysDomains

FEN 2014-03-23

RelationsCardinality ratioParticipation (total / partial)Relations may have attributes

Weak Entity TypesIdentifying ownerIdentifying relationPartial keyA weak entity always has total participation in the identifying relation.

Customer Account

custNo name accNo balance

inRate

Owns1 n

6

Example: The Company Database (Elmasri)

FEN 2014-03-23

7

Entities?

FEN 2014-03-23

Department: name(kk), number(kk), locationProject: name(kk), number(kk), locationEmployee: ssn(kk), bdate, name (poss. composite), sex, address (poss. composite), salaryDependent (weak?): name (partial key), sex, bdate

Example: The Company Database (Elmasri)

8

Relations?

FEN 2014-03-23

ManagesWorks_ForWorks_OnDependents_OfSupervisionControls

Example: The Company Database (Elmasri)

9

ER Diagram for the Company Database

FEN 2014-03-23

Example: The Company Database (Elmasri)

Note the similarities to UML domain models -

more on this later

10

Relations of Degree > 2

FEN 2014-03-23

Often causes problem in database designMay be transformed to binary relations or entitiesNot to be considered in this introduction

11

Example/Exercise (Elmasri)

FEN 2014-03-23

Questions:Can a customer exists without an account?Can an account have more owners?How many branches can account belong to?Can a customer have accounts in more than one branch?…???