CSCI380-Week 10-Lecture 1
CSCI380-Week 10-Lecture 1
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved.
Data Modeling
6-3
Data Modeling Concepts: Entity
Entity a class of persons, places, objects, events, or
concepts about which we need to capture and store data.
Named by a singular noun
Persons: agency, contractor, customer,
department, division, employee, instructor,
student, supplier.
Places: sales region, building, room,
branch office, campus.
Objects: book, machine, part, product, raw material, software license,
software package, tool, vehicle model, vehicle.
Events: application, award, cancellation, class, flight, invoice, order,
registration, renewal, requisition, reservation, sale, trip.
Concepts: account, block of time, bond, course, fund, qualification, stock.
6-4
Data Modeling Concepts: Entity
Entity instance a single occurrence of an entity.
6-7
IMAGE Any picture or image.
Data Modeling Concepts:
Domains
Domain a property of an attribute that defines what values
an attribute can legitimately take on.
Representative Logical Domains for Logical Data Types
Data Type Domain Examples
NUMBER For integers, specify the range. {10-99}
For real numbers, specify the range and {1.000-799.999}
precision.
TEXT Maximum size of attribute. Text(30)
Actual values are usually infinite; however, users
may specify certain narrative restrictions.
DATE Variation on the MMDDYYYY format. MMYYYY / MMDDYY
TIME For AM/PM times: HHMMT HHMMT
For military (24-hour times): HHMM HHMM
YES/NO {YES, NO} {ON, OFF}
VALUE value#n} {M=Male,
6-8
SET F=Female}
Data Modeling Concepts:
Default Value
Default value the value that will be recorded if a value is
not specified by the user.
NONE or NULL For an instance of the attribute, if the user does not NONE
specify a value, then leave it blank. NULL
Required or NOT For an instance of the attribute, require that the REQUIRED
NULL user enter a legal value from the domain. (This is NOT NULL
used when no value in the domain is common
enough to be a default but some value must be
entered.)
6-9
Data Modeling Concepts:
Identification (ID)
Key an attribute, or a group of attributes,
that assumes a unique value for each entity
instance. It is sometimes called an identifier.
Concatenated key - a group of attributes that
uniquely identifies an instance of an entity.
Synonyms include composite key and
compound key.
Candidate key one of a number of keys that
may serve as the primary key of an entity. Also
called a candidate identifier.
Primary key a candidate key that will most
commonly be used to uniquely identify a single
entity instance.
Alternate key a candidate key that is not
selected to become the primary key is called
an alternate key. A synonym is secondary key.
6-10
Data Modeling Concepts:
Subsetting Criteria
Subsetting criteria
attribute(s) whose finite
values divide all entity
instances into useful
subsets. Sometimes called
inversion entry.
6-11
Data Modeling Concepts:
Relationships
Relationship a natural business association
that exists between one or more entities.
The relationship may represent an event that
links the entities or merely a logical affinity that
exists between the entities.
6-12
Data Modeling Concepts:
Cardinality
Cardinality the minimum and maximum
number of occurrences of one entity that may
be related to a single occurrence of the other
entity.
Because all relationships are bidirectional,
cardinality must be defined in both directions for
every relationship.
bidirectional
Student Is being studied by is enrolled in
Curriculum
6-13
Cardinality Notations
6-14
Data Modeling Concepts:
Degree
Degree the number of entities that
participate in the relationship.
A relationship between two entities is called
a binary relationship.
A relationship between three entities is called
a 3-ary or ternary relationship.
A relationship between different instances of
the same entity is called a recursive
relationship.
6-15
Data Modeling Concepts:
Degree (N-ary Relationships)
Relationships may
exist between
more than two
entities and are
called N-ary
relationships.
The example ERD
depicts a ternary
relationship.
6-16
Data Modeling Concepts:
Degree
Associative entity
an entity that inherits its
primary key from more
than one other entity
(called parents).
6-17
Data Modeling Concepts:
Recursive Relationship
6-18