Chapter 3-1 and 3-2
Chapter 3-1 and 3-2
2:
The Logical Relational
Data Model
DATABASE MANAGEMENT AND DESIGN
Physical Database Models
Physical data addresses
Limitations:
Pointers
◦Two records related only if
Indexes
there were existing
Student and Grade Pointer Index
Student Address Assignment Addr Grade Address
pointers
0354A8FB23 0128FE83BA 129183AFD9 ◦Vulnerable to changes in
the physical environment
Student Assign Grade ◦ New drives
File File File
◦ Additional columns in files
◦ Insertions of rows in the files
Relational Database Model
Codd, 1970
Based on logical instead of physical relationships in data
◦ Overcomes limitations of physical designs
◦ Logical design allows the user (and applications) to be
unconcerned with the physical structure of the data
◦ Allowed for structured languages to provide more flexible and
robust access to manipulating data (SQL)
Relations
Relation
◦ Mathematical term
◦ A simple two dimensional table
Attribute
◦ Column of the relation
◦ Order does not matter
◦ Column names must be unique
Domain
◦ Set of all possible values for an attribute
◦ Two attributes with the same domain can have different names
Tuple
◦ Row of the relation
◦ Order does not matter
◦ No two tuples can have identical sets of values
Null Values
◦ Unknown data
◦ Not blank or 0
Attribute
◦ Column of the relation
◦ Order does not matter
◦ Column names must be unique
Domain
◦ Set of all possible values for an attribute
◦ Two attributes with the same domain can have different names
Tuple
◦ Row of the relation
◦ Order does not matter
◦ No two tuples can have identical sets of values
Null Values
◦ Unknown data
◦ Not blank or 0
Attribute
◦ Column of the relation
◦ Order does not matter
◦ Column names must be unique
Domain
◦ Set of all possible values for an attribute
◦ Two attributes with the same domain can have
different names
Tuple
◦ Row of the relation
◦ Order does not matter
◦ No two tuples can have identical sets of values
Null Values
◦ Unknown data
◦ Not blank or 0
Attribute
◦ Column of the relation
◦ Order does not matter
◦ Column names must be unique
Domain
◦ Set of all possible values for an attribute
◦ Two attributes with the same domain can have different names
Tuple
◦ Row of the relation
◦ Order does not matter
◦ No two tuples can have identical sets of values
Null Values
◦ Unknown data
◦ Not blank or 0
Attribute
◦ Column of the relation
◦ Order does not matter
◦ Column names must be unique
Domain
◦ Set of all possible values for an attribute
◦ Two attributes with the same domain can have different names
Tuple
◦ Row of the relation
◦ Order does not matter
◦ No two tuples can have identical sets of values
Null Values
◦ Unknown data
◦ Not blank or 0
Student (StudentID, StudentNumber, FirstName, LastName,
StreetAddress, City, CellPhone)
Relation
Relations
◦ Mathematical term
◦ A simple two dimensional table
Attribute
◦ Column of the relation
◦ Order does not matter
◦ Column names must be unique
Domain
◦ Set of all possible values for an attribute
A common textual notation used to represent a relation
◦ Two attributes with the same domain can have different names
Student:
Tuple Student (StudentID, StudentNumber, FirstName, LastName,
◦ Row of the relation StreetAddress, City, CellPhone)
◦ Order does not matter
◦ No two tuples can have identical sets of values
Null Values
◦ Unknown data
◦ Not blank or 0
Relation (Primary) Keys
Database rows (see Course table to the right)
◦ Contain information about instance courses
◦ Each course is represented by exactly 1 row
◦ Rows have identifiers to ensure that:
◦ Data for each course exists on only 1 row of the relation
◦ Each row contains only data for 1 course
◦ CourseID fills this role, thus each value of CourseID must be unique
Position
PositionID PositionTitle DegreeRequired
Location
LocationID City State LocationPhone
Position
PositionID PositionTitle DegreeRequired
Position (PositionID, PositionTitle, EducationRequired)
Location
LocationID City State LocationPhone
Professor
ProfessorID ProfessorName ProfessorDegree ProfessorDepartment ProfessorRank
Course
CourseID CourseNumber CourseTitle CourseDepartment
Section
SectionID CourseID SectionNumber
Class Schedule Relations
Student
StudentID StudentName StudentMajor StudentPhone
Professor
ProfessorID ProfessorName ProfessorDegree ProfessorDepartment ProfessorRank
Course
CourseID CourseNumber CourseTitle CourseDepartment
Section
SectionID CourseID SectionNumber ProfessorID
Enrollment
SectionID StudentID
Class Schedule Schema
Student (StudentID, StudentName, StudentMajor, StudentPhone)
Professor (ProfessorID, ProfessorName, ProfessorDegree, ProfessorDepartment, ProfessorRank)
Course (CourseID, CourseNumber, CourseTitle, CourseDepartment)
Section (SectionID, CourseID, SectionNumber, ProfessorID)
◦ Foreign Key CourseID references Course
◦ Foreign Key ProfessorID references Professor
Order
OrderNumber Tax Total OrderDate
Product
StockNumber Description Price
Payment
CheckNumber Date
Don’s Donuts Relations with Keys
Vendor
VendorNumber VendorName VendorAddress VendorPhone VendorContact
Order
OrderNumber Tax Total OrderDate VendorNumber CheckNumber
Product
StockNumber Description Price
ProductOrder Payment
OrderNumber StockNumber Quantity CheckNumber Date
Don’s Donuts Schema
Vendor (VendorNumber, VendorName, VendorAddress, VendorPhone, VendorContact)
Order (OrderNumber, Tax, Total, OrderDate, VendorNumber, CheckNumber)
◦ Foreign Key VendorNumber references Vendor
◦ Foreign Key CheckNumber reference Payment