it 21103/41103 system analysis & design. chapter 04 data modeling

53
IT 21103/41103 IT 21103/41103 System Analysis & Design System Analysis & Design

Upload: annabel-warner

Post on 04-Jan-2016

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

IT 21103/41103IT 21103/41103

System Analysis & DesignSystem Analysis & Design

Page 2: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Chapter 04Chapter 04

Data ModelingData Modeling

Page 3: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Concerned with the data flow of an Concerned with the data flow of an organizationorganization

Page 4: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Focuses on Data OnlyFocuses on Data Only

Page 5: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Data AttributesData Attributes

NameName

SizeSize

TypeType

Page 6: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

NameName

Unique IndentiferUnique Indentifer

Page 7: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

SizeSize

Amount of space required to hold Amount of space required to hold the datathe data

Page 8: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

TypeType

How the computer stores the dataHow the computer stores the data

Page 9: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Data StructuresData Structures

Specific organizational strategies Specific organizational strategies for associating data elementsfor associating data elements

Page 10: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Examples:Examples:

ReceiptsReceipts

File FoldersFile Folders

Page 11: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Computer Data StructuresComputer Data Structures

Mimic the real-worldMimic the real-world

Helps the analyst link data to the Helps the analyst link data to the new systemnew system

Page 12: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Data StreamsData Streams

Series of characters that form a Series of characters that form a command or represent specific data command or represent specific data

values in a programvalues in a program

Page 13: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

FileFile

Organized data structure with a Organized data structure with a specific formatspecific format

Page 14: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Master FileMaster File

Identifies an individual person or Identifies an individual person or thing in the organizationthing in the organization

Page 15: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Transaction FileTransaction File

Data collection that represents a Data collection that represents a specific event or activityspecific event or activity

Page 16: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

DatabaseDatabase

Collection of files containing data Collection of files containing data about the current operations of an about the current operations of an

organizationorganization

Page 17: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Data WarehouseData Warehouse

Collection of files about the past Collection of files about the past operations of an organization operations of an organization

Page 18: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Relational DatabasesRelational Databases

Collection of data tied together by Collection of data tied together by common fields common fields

Page 19: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Common FieldsCommon Fields

Primary Key Field(s)Primary Key Field(s)

Foreign Key Field(s) - Create RelationshipsForeign Key Field(s) - Create Relationships

Page 20: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Data ModelingData Modeling

Entity-Relationship Diagram -Entity-Relationship Diagram -

ERDERD

Page 21: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

►The Entity-Relationship ApproachThe Entity-Relationship Approach Represents reality using well-defined Represents reality using well-defined

graphics and rulesgraphics and rules►Basic building blocks are “things” (entities) Basic building blocks are “things” (entities)

and relationshipsand relationships

Member

Animal

M

1 Adopts

Page 22: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

► AdvantagesAdvantages Theoretical foundation (Set Theory)Theoretical foundation (Set Theory) Good for communicationGood for communication Build E-R Model, then translate to any type of Build E-R Model, then translate to any type of

RDBMSRDBMS

► DisadvantagesDisadvantages Different (yet another new thing to learn)Different (yet another new thing to learn) Must translate to the relational modelMust translate to the relational model

Page 23: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

►Entity-Relationship Model: Basic Entity-Relationship Model: Basic ConceptsConcepts EntityEntity

►Thing, Object, Concept of interest to the Thing, Object, Concept of interest to the enterpriseenterprise

►Each occurrence can be uniquely identifiedEach occurrence can be uniquely identified

Page 24: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

►Entity-Relationship Model: Basic Entity-Relationship Model: Basic ConceptsConcepts AttributeAttribute

►Property of an entityProperty of an entity►ColumnColumn

Page 25: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

►Entity-Relationship Model: Basic Entity-Relationship Model: Basic ConceptsConcepts RelationshipRelationship

►Association between two (or more) entitiesAssociation between two (or more) entities

Page 26: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

►Entity-Relationship Model: Basic Entity-Relationship Model: Basic ConceptsConcepts Entity IdentifierEntity Identifier

►Attribute(s) whose value uniquely identifies an Attribute(s) whose value uniquely identifies an entityentity

►Primary KeyPrimary Key

Page 27: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

►What is an Entity?What is an Entity? Physical entity typesPhysical entity types

►PersonPerson►BuildingBuilding►MachineMachine►BookBook►Usually SingularUsually Singular

Page 28: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

►What is an Entity?What is an Entity? Conceptual entity typesConceptual entity types

►ContractContract►AccountAccount►OrderOrder►CourseCourse

Page 29: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

►What is an Entity?What is an Entity? Event entity typesEvent entity types

►TransactionTransaction►ShipmentShipment►ReservationReservation►Phone CallPhone Call►Seminar OfferingSeminar Offering

Page 30: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD► Entity-Relationship Model: DiagramsEntity-Relationship Model: Diagrams

Example:Example:

Soft Rectangle represents entitiesSoft Rectangle represents entities► NounNoun► SingularSingular

Connecting Line represents relationshipsConnecting Line represents relationships► VerbVerb

Member

Animal

Adopts

Page 31: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►Relationships have Relationships have

CharacteristicsCharacteristics A relationship has Cardinality A relationship has Cardinality

(Degree)(Degree)

One-to-One One-to-Many Many-to-Many

Page 32: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►Each entity’s participation is Each entity’s participation is

Mandatory or OptionalMandatory or Optional

►Cardinality & OptionalityCardinality & Optionality

are based on business rulesare based on business rules

Mandatory

Optional

Page 33: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►One:One RelationshipOne:One Relationship

One Member adopts one animalOne Member adopts one animal One Animal is adopted by one One Animal is adopted by one

membermember

Member

Animal

Adopts

Page 34: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►One:Many relationshipOne:Many relationship

One member adopts one animalOne member adopts one animal One animal is adopted by many One animal is adopted by many

membersmembers

Member

Animal

Adopts

Page 35: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►Many:Many relationshipMany:Many relationship

One member adopts many animalsOne member adopts many animals One animal is adopted by many One animal is adopted by many

membersmembers

Member

Animal

Adopts

Page 36: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►Optionality: Participation in a Optionality: Participation in a

RelationshipRelationship

Zoo Employee

Animal

Cares for

Page 37: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►MandatoryMandatory

Every instance of the entity MUST Every instance of the entity MUST participate in the relationshipparticipate in the relationship

Example:Example:►Every animal is cared for by at least one Every animal is cared for by at least one

employeeemployee

Page 38: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►OptionalOptional

An instance of the entity CAN An instance of the entity CAN participate in the relationshipparticipate in the relationship

Example:Example:►Some employees do not take care of Some employees do not take care of

animalsanimals

Page 39: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►Drawing an E-R DiagramDrawing an E-R Diagram

Identify the entitiesIdentify the entities Write (make up) a few attributes for Write (make up) a few attributes for

each entityeach entity Designate the unique identifier (PK)Designate the unique identifier (PK) Identify the relationship (FK goes on Identify the relationship (FK goes on

the many side)the many side) Show cardinality and optionality for Show cardinality and optionality for

each relationshipeach relationship

Page 40: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD► E-R Modeling Exercise: E-R Modeling Exercise:

A Seminar CompanyA Seminar Company► A seminar company offers more than 100 A seminar company offers more than 100

different coursesdifferent courses Each course has a unique course number and a Each course has a unique course number and a

titletitle► The company schedules thousands of seminars The company schedules thousands of seminars

annuallyannually Each seminar is the presentation of one specific Each seminar is the presentation of one specific

coursecourse A seminar is either public or on-siteA seminar is either public or on-site

Page 41: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling
Page 42: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►E-R Model:E-R Model:

EntitiesEntities►CourseCourse

Course #Course # (PK) (PK) Course TitleCourse Title DurationDuration AuthorAuthor

Page 43: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD► E-R Model:E-R Model:

EntitiesEntities► SeminarSeminar

Seminar #Seminar # (PK) (PK) DateDate PlacePlace TypeType

► PublicPublic► On-siteOn-site

Course # (FK)Course # (FK)

Page 44: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►E-R Model:E-R Model:

COURSE

SEMINAR

Presented by

Page 45: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►E-R Modeling Exercise: E-R Modeling Exercise:

A Personnel DatabaseA Personnel Database►A company has four divisionsA company has four divisions►Each employee works for a departmentEach employee works for a department►Each department reports to one of the Each department reports to one of the

divisionsdivisions

Page 46: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►E-R Model:E-R Model:

EntitiesEntities►DivisionDivision

Division #Division # Division NameDivision Name

Page 47: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►E-R Model:E-R Model:

EntitiesEntities►EmployeeEmployee

Employee #Employee # Employee NameEmployee Name Dept # (FK)Dept # (FK)

Page 48: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►E-R Model:E-R Model:

EntitiesEntities►DepartmentDepartment

Dept #Dept # Dept NameDept Name Div # (FK)Div # (FK)

Page 49: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD►E-R Model:E-R Model:

DIVISION DEPARTMENTReports to

EMPLOYEE

Works for

Page 50: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Relational Database TheoryRelational Database Theory► E-R Modeling Exercise: E-R Modeling Exercise:

A Supplier-Parts DatabaseA Supplier-Parts Database► A company purchases many parts from its A company purchases many parts from its

supplierssuppliers Each part has only one supplierEach part has only one supplier

► A supplier can supply zero, one, or many partsA supplier can supply zero, one, or many parts

One _____(can/must) One _____(can/must) __________

((one one and only one/one or more) and only one/one or more) ____________

Page 51: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling
Page 52: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

Relational Database TheoryRelational Database Theory►E-R Model:E-R Model:

SUPPLIER

PARTS

Supplies

Page 53: IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling

ERDERD

Assignment 04Assignment 04

Page 117Page 117