The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of...

13
The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma

Transcript of The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of...

Page 1: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

The Entity-Relationship Model(Chapter 3a)

Laku Chidambaram W.P. Wood Professor of MISUniversity of Oklahoma

Page 2: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Overview

Database Design: The E-R Model

Entities

Attributes

Relationships

Page 3: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Database Design

EngineerEngineer(A/C Receivable)(A/C Receivable)

EngineerEngineer(A/C Receivable)(A/C Receivable)

PilotPilot(Order Entry)(Order Entry)

PilotPilot(Order Entry)(Order Entry)

PassengerPassenger (Inventory)(Inventory)

PassengerPassenger (Inventory)(Inventory)

ExternalView

General DesignGeneral Design(Comprehensive Data Model) (Comprehensive Data Model)

General DesignGeneral Design(Comprehensive Data Model) (Comprehensive Data Model)

ConceptualModel (ERD)

BlueprintBlueprint(Database Schema) (Database Schema)

BlueprintBlueprint(Database Schema) (Database Schema)

Logical Model(Relational)

AircraftAircraft(Database)(Database)

Physical Reality(DBMS)

Page 4: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

The Entity Relationship Diagram

An E-R diagram is a graphical representation of an organization’s data

Such data includes the people, places,

objects, events, or concepts (along with their characteristics and relationships) that are relevant to an organization

Page 5: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Entities

Person, place, object, event, or concept about which the organization wishes to collect and maintain data

Nouns are used to describe entitiesExamples:

Employee, Student, Nurse City, State, Country Sale, Registration, Account

Entity Type versus Entity Instance

Page 6: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Types of Entities

Strong Entity: can exist independently

Weak Entity: cannot exist without the “owner” entity (with which it has an identifying relationship) Has a primary key that is derived from the owner entity in

the relationship

EMPLOYEE

EMPLOYEEhas

DEPENDENT

Page 7: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Attributes

Properties or characteristics of entities (or relationships)

Provide the actual data that describe entities (or relationships)

EMPLOYEE

E_Address

E_Name

E_ID

Page 8: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Unique Attributes

Candidate keys are ALL attributes that uniquely define an instance of an entity

A primary key is the candidate key that is chosen as the “most” unique of them all!

A primary key (or identifier) is ideal if it: does not change over time has unique values that are not null does not use “intelligent” features (Note: may need to substitute simple keys for long,

i.e., composite, keys)

Page 9: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Composite Attributes

Attributes that are not “atomic” (or simple), i.e., those attributes that can (and need to) be broken down further

EMPLOYEE

E_Address (E_Street,

E_City,

E-Zip)

E_Name

E_ID

Page 10: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Multi-valued Attributes

Some attributes may have multiple values ...

… but they may need to be “fixed” before proceeding

EMPLOYEE{E_Skill}

EMPLOYEE has SKILL

S_Code

S_Name

Page 11: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Derived Attributes

Those attributes whose values can be calculated from the values of other attributes (either in the database or in the system).

Value is not stored in the database (since it does not take up any space) E.g., Age can be calculated, where date-of-birth is stored

Page 12: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

RelationshipsRefer to the associations (or links) between entitiesUse verbs to describe the links May have attributes (in some cases)Are directional

STUDENTLives in

DORMITORY

EMPLOYEE Works in STORE STORE

Page 13: The Entity-Relationship Model (Chapter 3a) Laku Chidambaram W.P. Wood Professor of MIS University of Oklahoma.

© Laku Chidambaram, Ph.D.

Associative Entities

A (many-to-many) relationship that is better represented as an entity because it: contains attributes from the entities it links

and has its own attributes has independent meaning to end-users

CUSTOMEROrders PRODUCT

CUSTOMER ORDER PRODUCT