Академический Документы
Профессиональный Документы
Культура Документы
Review
Victor Raj, PhD
Murray State University
Objectives
In this module, we will review the
following:
Primary key & its characteristics
Composite Keys
Foreign keys
Anomalies & Relationships
Dependencies and Normalization
CIS609 (Review)
Tables
Table: two-dimensional structure
composed of rows and columns
CIS609 (Review)
What is a database
table?
CIS609 (Review)
Primary Key
Each row in a table must be uniquely
identifiable
CIS609 (Review)
Keys (continued)
Composite key
A key that is composed of more than one attribute
Key attribute
Any attribute that is part of a key
CIS609 (Review)
CIS609 (Review)
Nulls (continued)
Issues with Nulls:
Can create problems when functions such
as COUNT, AVERAGE, and SUM are used
Back to Keys
Foreign key (FK)
An attribute whose values match primary key values
in a related table
Referential integrity
FK MUST contain a value that refers to an existing
valid row in another table
CIS609 (Review)
Integrity rules
CIS609 (Review)
10
11
Redundancy
Simply means duplication
Controlled redundancy:
Makes the relational database work
Facilitates linking of tables together
Multiple occurrences of values not redundant
when required to make the relationship work
12
Excessive redundancy
Anomalies
Insert - You cannot add a row without being forced to
add information that may not yet be available
CIS609 (Review)
13
Update anomaly
Whats the problem here?
CIS609 (Review)
14
Deletion anomaly
Mnumbe
r
Last
name
First
name
Course
Time
Room
M001
Smith
Job
ACC200 11:30
MW
BB302
M002
Smith
Jhansi
ACC200 12:30
TR
BB302
M001
Smith
Job
BUS215 12:30
What challenges do you face
MW
when you delete a student? Or a
Kline
Smith
course?BUS215 12:30
MW
BB206
M003
CIS609 (Review)
BB206
15
Insertion anomaly
Mnumbe
r
Last
name
First
name
Course
Time
Room
ACC200 11:30
MW
BB302
ACC200 12:30
TR
BB302
BUS215 12:30
Can you list all available courses?
MW
(Recall definition of PK No NULLS
allowed)
CIS609 (Review)
BB206
16
17
1:1 relationship
Should be rare in any relational database
design
M:N relationships
Also very common, but missed by novices
Converted to two (or more) 1:M relationships
CIS609 (Review)
18
CIS609 (Review)
19
Implementing 1:M
CIS609 (Review)
20
CIS609 (Review)
21
22
CIS609 (Review)
23
Ensures
referential
integrity...
Cannot enroll
students in
classes that
dont exist. Or
enroll students
that dont exist
in STUDENT
CIS609 (Review)
24
This separation
ensures that the
course
information (title,
credits etc.) are
not repeated
unnecessarily.
CIS609 (Review)
25
Degree
CIS609 (Review)
26
27
Normal forms
First no repeating groups, but very
likely to have partial dependencies
28
Repeating groups
CIS609 (Review)
29
Partial dependency
CIS609 (Review)
30
31
Summary - 1
Tables are basic building blocks of a
relational database
32
Summary - 2
Each table row must have a primary key
33
Summary - 3
Normalization
First no repeating groups, will have partial
dependency
34