Information Systems Program
Module 3
Relational Data Model and
CREATE TABLE Statement
Lesson 2: Integrity Rules
Lesson Objectives
• Identify 1-M relationships and associated PKs
and FKs
• Find errors in rows with either orphan FKs or
missing FKs
• Identify situations for FK requirements
– FK is necessary
– FK can have the null value
Information Systems Program
Integrity Rules
• Entity integrity: primary keys
– Each table has column(s) with unique values
– No missing values for primary keys
– Ensures traceable entities
• Referential integrity: foreign keys
– Values of a column in one table match values from a
source table
– Ensures valid references among tables
Information Systems Program
Integrity Rule Violations
Student Offering
StdNo StdLastName OfferNo CourseNo
123-45-6789 WELLS 1234 IS320
124-56-7890 KENDALL 4321 IS320
234-56-7890 NORBERT
-- JONES
Enrollment
StdNo OfferNo
123-45-6789 1234
234-56-7890 1234
123-45-6789 4321
124-56-7890 4321
234-56-7890 6789
-- 4321
Information Systems Program
Oracle Relational Diagram
Information Systems Program
Summary
• Identify primary keys and foreign keys
• Visualize relationships
• Understanding existing databases is crucial to
query formulation
Information Systems Program