0% found this document useful (0 votes)
22 views

CSCI380-Week 10-Lecture 1

Uploaded by

12110159
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

CSCI380-Week 10-Lecture 1

Uploaded by

12110159
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Chapter 6

Data Modeling and


Analysis

McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved.
Data Modeling

Data modeling a technique for organizing

Sometimes called database modeling.

Entity relationship diagram (ERD) a


data model utilizing several notations to
depict data in terms of the entities and
relationships described by that data.
6-2
Sample Entity Relationship
Diagram (ERD)

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.

Entity Student ID Last Name First Name


2144 Arnold Betty
3122 Taylor John
3843 Simmons Lisa
Instance
9844 Macy Bill
2837 Leath Heather
2293 Wrench Tim
6-5
Data Modeling Concepts:
Attributes
Attribute a descriptive property or
characteristic of an entity. Synonyms
include element, property, and field.
Just as a physical student can have
attributes, such as hair color, height, etc.,
a data entity has data attributes

Compound attribute an attribute that


consists of other attributes. Synonyms in
different data modeling languages are
numerous: concatenated attribute,
composite attribute, and data structure.
6-6
Data Modeling Concepts: Data
Type
Data type a property of an attribute that identifies what
type of data can be stored in that attribute.
Representative Logical Data Types for Attributes
Data Type Logical Business Meaning
NUMBER Any number: real or integer.
TEXT A string of characters, inclusive of numbers.
MEMO Same as TEXT but of an indeterminate size. Some business systems
require the ability to attach potentially lengthy notes to a given
database record.
DATE Any date in any format.
TIME Any time in any format.
YES/NO An attribute that can assume only one of these two values.
VALUE SET A finite set of values. In most cases, a coding scheme would be
established (e.g., FR = Freshman, SO = Sophomore, JR = Junior, SR =
Senior).

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.

Permissible Default Values for Attributes

Default Value Interpretation Examples


A legal value For an instance of the attribute, if the user does not 0
from the domain specify a value, then use this value. 1.00

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.

Student Is being studied by is enrolled in


Curriculum

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).

Each part of that


concatenated key
points to one and only
one instance of each of
the connecting entities.
Associative
Entity

6-17
Data Modeling Concepts:
Recursive Relationship

6-18

You might also like