IT 21103/41103IT 21103/41103
System Analysis & DesignSystem Analysis & Design
Chapter 04Chapter 04
Data ModelingData Modeling
Data ModelingData Modeling
Concerned with the data flow of an Concerned with the data flow of an organizationorganization
Data ModelingData Modeling
Focuses on Data OnlyFocuses on Data Only
Data ModelingData Modeling
Data AttributesData Attributes
NameName
SizeSize
TypeType
Data ModelingData Modeling
NameName
Unique IndentiferUnique Indentifer
Data ModelingData Modeling
SizeSize
Amount of space required to hold Amount of space required to hold the datathe data
Data ModelingData Modeling
TypeType
How the computer stores the dataHow the computer stores the data
Data ModelingData Modeling
Data StructuresData Structures
Specific organizational strategies Specific organizational strategies for associating data elementsfor associating data elements
Data ModelingData Modeling
Examples:Examples:
ReceiptsReceipts
File FoldersFile Folders
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
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
Data ModelingData Modeling
FileFile
Organized data structure with a Organized data structure with a specific formatspecific format
Data ModelingData Modeling
Master FileMaster File
Identifies an individual person or Identifies an individual person or thing in the organizationthing in the organization
Data ModelingData Modeling
Transaction FileTransaction File
Data collection that represents a Data collection that represents a specific event or activityspecific event or activity
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
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
Data ModelingData Modeling
Relational DatabasesRelational Databases
Collection of data tied together by Collection of data tied together by common fields common fields
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
Data ModelingData Modeling
Entity-Relationship Diagram -Entity-Relationship Diagram -
ERDERD
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
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
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
ERDERD
►Entity-Relationship Model: Basic Entity-Relationship Model: Basic ConceptsConcepts AttributeAttribute
►Property of an entityProperty of an entity►ColumnColumn
ERDERD
►Entity-Relationship Model: Basic Entity-Relationship Model: Basic ConceptsConcepts RelationshipRelationship
►Association between two (or more) entitiesAssociation between two (or more) entities
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
ERDERD
►What is an Entity?What is an Entity? Physical entity typesPhysical entity types
►PersonPerson►BuildingBuilding►MachineMachine►BookBook►Usually SingularUsually Singular
ERDERD
►What is an Entity?What is an Entity? Conceptual entity typesConceptual entity types
►ContractContract►AccountAccount►OrderOrder►CourseCourse
ERDERD
►What is an Entity?What is an Entity? Event entity typesEvent entity types
►TransactionTransaction►ShipmentShipment►ReservationReservation►Phone CallPhone Call►Seminar OfferingSeminar Offering
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
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
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
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
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
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
ERDERD►Optionality: Participation in a Optionality: Participation in a
RelationshipRelationship
Zoo Employee
Animal
Cares for
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
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
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
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
ERDERD►E-R Model:E-R Model:
EntitiesEntities►CourseCourse
Course #Course # (PK) (PK) Course TitleCourse Title DurationDuration AuthorAuthor
ERDERD► E-R Model:E-R Model:
EntitiesEntities► SeminarSeminar
Seminar #Seminar # (PK) (PK) DateDate PlacePlace TypeType
► PublicPublic► On-siteOn-site
Course # (FK)Course # (FK)
ERDERD►E-R Model:E-R Model:
COURSE
SEMINAR
Presented by
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
ERDERD►E-R Model:E-R Model:
EntitiesEntities►DivisionDivision
Division #Division # Division NameDivision Name
ERDERD►E-R Model:E-R Model:
EntitiesEntities►EmployeeEmployee
Employee #Employee # Employee NameEmployee Name Dept # (FK)Dept # (FK)
ERDERD►E-R Model:E-R Model:
EntitiesEntities►DepartmentDepartment
Dept #Dept # Dept NameDept Name Div # (FK)Div # (FK)
ERDERD►E-R Model:E-R Model:
DIVISION DEPARTMENTReports to
EMPLOYEE
Works for
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) ____________
Relational Database TheoryRelational Database Theory►E-R Model:E-R Model:
SUPPLIER
PARTS
Supplies
ERDERD
Assignment 04Assignment 04
Page 117Page 117