Data Model

 

Introduction

Entity-Relationship Model (ER)

 

The Big Picture

Miniworld

|

REQUIREMENTS COLLECTION AND ANALYSIS ---> Functional Requirements ---> FUNCTIONAL ANALYSIS ---> High-level Transaction Specification

|

Database Requirements

|

CONCEPTUAL DESIGN

|

Conceptual Schema (In a high-level data model)

|

LOGICAL DESIGN (DATA MODEL MAPPING)

DBMS-independent ----------------------------------------------------------------------------------------

DBMS-specific ---------------------------------------------------------------------------------------------

|

Logical (Conceptual) Schema (In the data model of a specific DBMS)

|

PHYSICAL DESIGN <--- High-level Transaction Specification ---> APPLICATION PROGRAM DESIGN ---> TRANSACTION IMPLEMENTATION ---> Applicationi Programs

|

Internal Schema (For the same DBMS)

 

Figure: Simplified phases of database design

 

Overview of ER

Learn by example:

Design a DB for a company to store employee data

 

Requirement

Company has:

 

Charasteristies

A company has various depts

Each dept has:

Figure xxx

Each project has a unique name number and a location

 

More

Each employee has

"Employee" vs "employee"

Dependents

Figure xxx

 

Each employee is assigned to one dept but may work on several projects.

Figure xxx

Detail P43 and P59

 

Where do we start?

Entity - an object with conceptual existence

Attributes - properties of an entity. e.g. name, age, ID, ...

Value - assigned to an attribute

For example: Employee entity, ei and company entity ci

 

ei

name = bubba

addr = texas

age = 45

phone = 612-6xx-xxxx

(Attribute = Value)

ci

name = xxx

addr = xxx

ceo = bubba

phone

 

Syntax

Simple Attributes are not divisible

==> atomic (Age = 5, GPA = 3.5)

 

Composite is divided into subparts

e.g. addr = street#, street name, city, state

 

Hierachy of Composite Attributes

addr

city (atomic)

state (atomic)

zip (atomic)

 
  street addr

number

street name

apt #

 

Single vs Multivalued Attributes

Single - one value for a particular entity (e.g. age)

Multivalue - > 1 value or (lbound/lower bound, ubound/upper bound)
e.g. (fr, soph, jr, grad, openu)

 

Stored vs Derived Attributes

s = start-date

c = current-date

employment-length = c - s
(Derived from c & s)

e.g. Number of employee = counting num of emp in Dept Entity

 

Special Value

Null:

 

Example

Student <- Entity Type

------
Name
------
ID
------
Sex
------

 

Entity Set (Extension)

e1 Bubba 123 M
e2 John 456 M
e3 Sue 665 F

 

More Terms

Key

 

Domain of Attribute

 

Relationship

Figure xxx

e1 and ej works for dk

Degree of ri = 2

 

Degree of Relationship

Binary:

---- O ----

 

Tenary:

----- |
---- O ----

 

Cardinality Ratio

Shows # of relationship instances an entity can participate in

(M : 1)

1 : 1 = one-to-one

1: N = one-to-many

M:N = many to many

 

Weak Entity Type

 

For example:

DEPENDENT --- name, [ ]

Two dependent has same name but belong to two different employment

OR

A Employee has two same name dependent

(When look at weak entity, we cannot unique identity who that is, e.g. dependent <- need to know the employee first).

In other words, Employee entity owns the dependent entries that are related to it.

Page 59 for all box labels

HW: What is Identifying Relationship Type means

 

Figure xxx: Employee, Supervision relationship

 

Need ER Model Homework