chapter 3-1 ch. 3 –data modeling designing an efficient and effective database that meets users’...

21
Chapter 3-1 Ch. 3 –Data Modeling Designing an efficient and effective database that meets users’ needs

Upload: cameron-cole

Post on 31-Dec-2015

231 views

Category:

Documents


5 download

TRANSCRIPT

Chapter 3-1

Ch. 3 –Data Modeling

Designing an efficient and effective database that meets users’ needs

Chapter 3-2

What is a Database?

Collection of organized data

Used by many different computer applications

Manipulated by database management systems or DBMS (e.g. MS Access)

Chapter 3-3

Significance of a Database

Critical and valuable part of every business

Growing volume of data and cost of storage

Distributed vs. centralized data processing/ storage

Security and privacy of data

Irreplaceable data and redundant backupNeed for accuracy (costs 10 times as much to fix problems created from inaccurate data as it does to get it right the first time)

Increasing internet connectivity with databases

Amazon has 7 data centers requiring 1 sq. mile, 18 football fields, 454k servers

Chapter 3-4

Data must be stored and organized systematically

Three important concepts: Data hierarchy Record structures Database keys

Storing Data in Databases

Chapter 3-5

Data Hierarchy

Data hierarchy -ascending order:Bit (binary digit, e.g. 0 for light off and 1 for light on)

Byte (eight bits traditionally needed to form one character, such as a letter or digit)

Data field (several bytes, e.g. word or number)

Record (set of data fields)

File (set of records)

Database (collection of files)

E.g. How would the computer store A2?

Bytes

Value

1000 k kilo

10002 M mega

10003 G giga

10004 T tera

10005 P peta

10006 E exa

10007 Z zetta

10008 Y yotta

Binary: 00000000 00000001 00000010 00000011 00000100 000001010000011

000000111 00001000 00001001 00001010 00001011

Hexadecimal: 0 1 2 3 4 5 6 7 8 9 A B

Chapter 3-6

Record Structures

Data fields in each record are usually pre-formatted for numbers, text, etc.

Example

Chapter 3-7

Data Dictionary Example

Chapter 3-8

Record Keys

Primary Record KeyUnique to each record. Generally, a person’s name is not a good primary key because several people with the same name might exist

Foreign KeysEnables records to have a common reference in multiple files

Chapter 3-9

Creating a Database

On the same day, a firm pays cash for a paper clip and hires a new CEO. Traditionally an AIS only captured economic events that affected resources (e.g. buying the paper clip but not hiring the CEO). Modern databases need to capture resources, events, and agents (REA).

Resources: Assets (e.g. cash, inventory, equipment, etc.)

Events: business activities divided into economic (or accounting) events, such as buying a paper clip, and business events, such as registering a student, or a student’s birthday

Agents: people associated with events, including both internal (employee) and external (customers)

According to the late, great Peter Drucker (father of modern management theory and Claremont business program). “People usually consider accounting to be financial. But that is valid only for the part, going back 700 years, that deals with assets, liabilities, and cash flows; it is only a small part of modern accounting. Indeed, accounting today deals with operations . . . money is simply a notation and the language in which to express nonmonetary events”. Do you agree?

Chapter 3-10

Entity Examples

Chapter 3-11

Normalization

Most data organized in flat files No sequence or order Difficult to find records Inefficient and redundant data

Normalization Process of examining and arranging file data Allows for more efficient use of data and smaller data

files (eliminates redundancy) Avoid problems in accessing and modifying data (e.g.

entering the same information into two separate tables magnifies errors and inefficiency)

Chapter 3-12

Unnormalized Data

Chapter 3-13

First Normal Form

In First Normal Form (1 NF) when: All data fields are well defined Data can be stored in a flat file

Problems Data redundancy Insertion anomaly Deletion anomaly

Also known as First Norm

Chapter 3-14

First Normal Form Example

Chapter 3-15

Second Normal Form

Second Normal Form (2 NF) achieved when: It is in 1 NF All data items depend on primary record key

Benefits More efficient design Eliminates data redundancy

Also known as Second Norm

Chapter 3-16

Second Normal Form Example

Chapter 3-17

Third Normal Form

Third Normal Form (3 NF) achieved when: It is in 2 NF Does not contain transitive dependencies Data field A does not determine data field B

Ultimate Goal Create database in 3 NF

Also known as Third Norm

Chapter 3-18

Third Normal Form Example

Chapter 3-19

Cardinality Relationships

Notations (N = No limit) One-to-one (1:1); None-to-one (0:1); One-to-many (1:N) ; Many-to-many (N:N), etc.

Determine which of the following cardinalities may be appropriate for each situation below (1,1), (1,N), (1,0), (0,N), (0,1), (N,1), (N,0) or (N,N):(1) Soc. Sec. # and name(2) Invoice # and a customer #(3) A customer and sales rep(4) A debit card and PIN(5) A parking ticket# and student ID#(6) a faculty member and course

Chapter 3-20

Relationship Tables

Provide greater flexibility

Need for Relationship Tables Linking tables with foreign keys Many-to-many relationships

Chapter 3-21

Relationship Database – tables linked by key