You are on page 1of 10

THE RELATIONAL MODEL

• The relational model portrays data in the form of


two dimensional ‘tables’.
• Its strength is the ease with which tables may be
linked to one another.
• Relational model is based on the relational algebra
functions of restrict, project, and join.
Relational Algebra
RESTRICT – filtering out rows, PROJECT – filtering out columns,
such as the dark blue such as the light blue

JOIN – build a new table or data set from multiple existing tables

X1 Y1 Y1 Z1 X1 Y1 Z1

X2 Y2 Y2 Z2 X2 Y2 Z2

X3 Y1 Y3 Z3 X3 Y1 Z1
ASSOCIATIONS AND CARDINALITY

• Association – the labeled line connecting two entities


or tables in a data model
• Describes the nature of the between them
• Represented with a verb, such as ships, requests, or
receives
• Cardinality – the degree of association between two
entities
• The number of possible occurrences in one table that are
associated with a single occurrence in a related table
• Used to determine primary keys and foreign keys
“Crow’s Feet” Cardinalities
(1:0,1)

(1:1)

(1:0,M)

(1:M)

(M:M)
PROPERLY DESIGNED RELATIONAL TABLES

• Each row in the table must be unique in at least one


attribute, which is the primary key.
• Tables are linked by embedding the primary key into
the related table as a foreign key.
• The attribute values in any column must all be of the
same class or data type.
• Each column in a given table must be uniquely
named.
• Tables must conform to the rules of normalization, i.e.,
free from structural dependencies or anomalies.
THREE TYPES OF ANOMALIES
• Insertion Anomaly: A new item cannot be
added to the table until at least one entity
uses a particular attribute item.
• Deletion Anomaly: If an attribute item used
by only one entity is deleted, all information
about that attribute item is lost.
• Update Anomaly: A modification on an
attribute must be made in each of the rows
in which the attribute appears.
• Anomalies can be corrected by creating
additional relational tables.
ADVANTAGES OF RELATIONAL TABLES

• Removes all three types of


anomalies
• Various items of interest
(customers, inventory, sales) are
stored in separate tables.
• Space is used efficiently.
• Very flexible – users can form ad
hoc relationships
THE NORMALIZATION PROCESS
• A process which systematically splits unnormalized
complex tables into smaller tables that meet two
conditions:
• all nonkey (secondary) attributes in the table are
dependent on the primary key
• all nonkey attributes are independent of the other nonkey
attributes
• When unnormalized tables are split and reduced to
third normal form, they must then be linked together by
foreign keys.
STEPS IN NORMALIZATION
Unnormalized table with
repeating groups Remove
repeating
groups
First normal
form 1NF
Remove
partial
dependencies
Second normal
form 2NF
Remove
transitive
Third normal dependencies
form 3NF

Remove
remaining
Higher normal anomalies
forms
ACCOUNTANTS AND DATA
NORMALIZATION
• Update anomalies can generate
conflicting and obsolete database values.
• Insertion anomalies can result in
unrecorded transactions and incomplete
audit trails.
• Deletion anomalies can cause the loss of
accounting records and the destruction of
audit trails.
• Accountants should understand the data
normalization process and be able to
determine whether a database is properly
normalized.

You might also like