Chapter_3
Chapter_3
Chapter 3
The Relational Database Model
Objectives
• Relational model
– View data logically rather than physically
• Table
– Structural and data independence
– Resembles a file conceptually
• Relational database model is easier to
understand than hierarchical and network
models
• Composite key
– Composed of more than one attribute
• Key attribute
– Any attribute that is part of a key
• Superkey
– Any key that uniquely identifies each row
• Candidate key
– A superkey without unnecessary attributes
• Entity integrity
– Each row (entity instance) in the table has its
own unique identity
• Nulls
– No data entry
– Not permitted in primary key
– Should be avoided in other attributes
• Controlled redundancy
– Makes the relational database work
– Tables within the database share common
attributes
• Enables tables to be linked together
– Multiple occurrences of values not redundant
when required to make the relationship work
– Redundancy exists only when there is
unnecessary duplication of attribute values
• Relational algebra
– Defines theoretical way of manipulating table
contents using relational operators
– Use of relational algebra operators on existing
relations produces new relations:
• SELECT • UNION
• PROJECT • DIFFERENCE
• JOIN • PRODUCT
• INTERSECT • DIVIDE
• Natural join
– Links tables by selecting rows with common
values in common attributes (join columns)
• Equijoin
– Links tables on the basis of an equality condition
that compares specified columns
• Theta join
– Any other comparison operator is used
• Inner join
– Only returns matched records from the tables
that are being joined
• Outer join
– Matched pairs are retained, and any unmatched
values in other table are left null