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

Course1Module03Lesson2

This document covers the Relational Data Model and the CREATE TABLE statement, focusing on integrity rules related to primary and foreign keys. It explains the definitions of null values, primary keys, and foreign keys, as well as the integrity rules that ensure valid relationships among tables. The document also provides examples of integrity rule violations and emphasizes the importance of understanding existing databases for effective query formulation.

Uploaded by

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

Course1Module03Lesson2

This document covers the Relational Data Model and the CREATE TABLE statement, focusing on integrity rules related to primary and foreign keys. It explains the definitions of null values, primary keys, and foreign keys, as well as the integrity rules that ensure valid relationships among tables. The document also provides examples of integrity rule violations and emphasizes the importance of understanding existing databases for effective query formulation.

Uploaded by

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

Information Systems Program

Module 3
Relational Data Model and
CREATE TABLE Statement

Lesson 2: Integrity Rules


Lesson Objectives
• Identify 1-M relationships and associated primary
keys (PKs) and foreign keys (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


Definitions

• Absence of a value (missing value)


Null value • Actual value unknown or not applicable for a row

Primary • Column or combination of columns with unique


values in each row
key (PK) • No extraneous columns (minimal)

Foreign • Column or combination of columns


• Related to a primary key in a related table
• Same data type and often same name as related
key (FK) PK

Information Systems Program


Integrity Rules
• Primary key for each table
• No missing (null) values for primary
Entity keys
• Ensures traceable entities
Integrity

• Two kinds of values for a foreign key in


a row
Referential • Match a primary key value of a related
table (usual)
Integrity • Null value (unusual)
• 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

You might also like