Data Modeling: Database Review
Data Modeling: Database Review
Segment 5
Database Review
Data modeling
• Data modeling is often the first step in database design as
the designers first create a conceptual model of how data
items relate to each other.
• Data modeling involves a progression from
conceptual model to logical model to physical schema.
• The Data Model typically evolves through the following
three general stages:
A) conceptual data model
B) logical data model
C) physical data model
1
1/3/2018
From the figure above, we can see that the only information
shown via the conceptual data model is the entities that describe
the data and the relationships between those entities. No other
information is shown through the conceptual data model.
2
1/3/2018
3
1/3/2018
4
1/3/2018
Data Models
Here we compare these three types of data models. The
table below compares the different features:
Fig.9.2 shows the different kinds of data modeling and database design that
go on during the whole systems development cycle.
5
1/3/2018
6
1/3/2018
Requirements Determination
Questions for Data Modeling
• What are subjects/objects of the business?
Data entities and descriptions
• What unique characteristics distinguish between
subjects/objects of the same type?
Primary keys
• What characteristics describe each subject/object?
Attributes and secondary keys
• How do you use the data?
Security controls and user access privileges
7
1/3/2018
ERD Vs DFD
DFD shows how data enter a system, are transformed in that
system, and how it is stored in it. On the other hand, ERD
represents the entity model and will show what a system or a
database will look like but not explain how to implement it.
With DFD, each of the processes and storings should have at
least one data flow going towards it and one leaving it. With
ERD, all the entities should represent a group of similar things.
All the definitions in ERD should be unambiguous.
8
1/3/2018
Entities
• An entity is a person, place ,object, event or concept about
which an organization wishes to maintain data.
• Some Examples: EMPLOYEE, STUDENT,STORE,
STATE, MACHINE, SALE, ACCOUNT
• Entity type (or entity class) collection of entities with
common characteristics (Eg:STUDENT)
• Entity instance: A single occurrence of an entity type (E.g
Eugene Ching)
• We use capital letters in naming an entity type and in an E-
R diagram, the name is placed inside a rectangle
representing the entity.
Attributes
9
1/3/2018
http://searchdatamanagement.techtarget.com
/answer/Definition-of-primary-super-foreign-
and-candidate-key-in-the-DBMS
Primary key
• A primary key is a column (or columns) in a table that
uniquely identifies the rows in that table.
CUSTOMERS
10
1/3/2018
• Candidate key
– A candidate key is a single field or the least combination of
fields that uniquely identifies each record in the table.
• Identifier
– A candidate key that has been selected as the
unique identifying characteristic for an entity type
11
1/3/2018
Multivalued Attributes
• An attribute that may take on more than one value for each
entity instance
• Represented on E-R Diagram in two ways:
– double-lined ellipse
– weak entity
12
1/3/2018
Simple attributes
13
1/3/2018
weak entity
• In a relational database, a weak entity is an entity that cannot
be uniquely identified by its attributes alone; therefore, it
must use a foreign key in conjunction with its attributes to
create a primary key
10.27
Relationships
• Relationship
– An association between the instances of one or more
entity types that is of interest to the organization
– Association indicates that an event has occurred or that
there is a natural link between entity types
– Relationships are always labeled with verb phrases
10.28
14
1/3/2018
Degree of Relationship
• Degree: number of entity types that
participate in a relationship
• Three cases
– Unary: between two instances of one entity type
– Binary: between the instances of two entity types
– Ternary: among the instances of three entity types
15
1/3/2018
Cardinality
• The number of instances of entity B that can or must be
associated with each instance of entity A
• Minimum Cardinality
– The minimum number of instances of entity B that may be
associated with each instance of entity A
• Maximum Cardinality
– The maximum number of instances of entity B that may be
associated with each instance of entity A
• Mandatory vs. Optional Cardinalities
– Specifies whether an instance must exist or can be absent in the
relationship
Cardinality-Example
16
1/3/2018
Cardinality Symbols
17
1/3/2018
Examples of cardinalities in
relationships
10.36
18
1/3/2018
Associative Entity
• An entity type that associates the instances of one or more entity types
and contains attributes that are peculiar to the relationship between
those entity instances.
• Ex: Suppose an organization wishes to record the date when an employee
completes each course. The attribute Date-Completed is not a property of
the entity EMPLOYEE nor a property of COURSE . It is a property of the
relationship between EMPLOYEE and COURSE.
• In this example, an associative entity called CERTIFICATE can replace the
‘completes’ relationship. In the new E-R diagram, we have one-to-many
relationships between EMPLOYEE and CERTIFICATE and also between
COURSE and CERTIFICATE
• In representing an associative entity, the diamond symbol is included
within the entity rectangle as a reminder that the entity was derived from
a relationship.
10.38
19
1/3/2018
Ternary relationship
20
1/3/2018
21
1/3/2018
Business rules
22
1/3/2018
Data Dictionary
• a set of information describing the contents, format, and
structure of a database and the relationship between its
elements, used to control access to and manipulation of the
database.
Domains
• The set of all data types and ranges of values that an attribute can
assume.
• Domain definitions specify some or all of the following characteristics:
• data type, length, format, range, allowable values, meaning,
uniqueness, and null support.
• Several advantages
• Domains verify that the values for an attribute are valid
• Domains ensure that various data manipulation operations are logical
• Domains help conserve effort in describing attribute characteristics
10.46
23
1/3/2018
Triggering Operations
• An assertion or rule that governs the validity of data manipulation
operations such as insert, update and delete
• Includes the following components:
• User rule
Statement of the business rule to be enforced by the trigger
• Event
Data manipulation operation (insert, delete, update) that initiates the
operation
• Entity Name
Name of entity being accessedand/ or modified
• Condition
Condition that causes the operation to be triggered
• Action
Action taken when the operation is triggered
24
1/3/2018
25
1/3/2018
26
1/3/2018
27