Relational Data Model
Relational Data Model
Information Management
The Relational Data Model
Learning Objectives
After completing this chapter, you will be able to:
Each table row (tuple) represents a single entity occurrence within the
entity set.
Each table column represents an attribute, and each column has a distinct
name.
Each column has a specific range of values known as the attribute domain.
Functional Dependence
value of one or more attributes determines the value of one
or more other attributes
Determinant Dependent
attribute whose value attribute whose value
determines another is determined by the
other attribute
Dependencies Examples of Functional Dependence
STU_NUM →
STU_LNAME
STU_NUM →
(STU_FNAME, STU_LNAME, STU_GPA)
(STU_FNAME, STU_LNAME, STU_NUM) →
(STU_DOB, STU_HRS,
STU_GPA)
A key that is composed of more than one attribute. Note: key attribute is an
Composite key
attribute that is part of a key.
link
Rules A foreign key may have either a null entry, as long as it is not a
part of its table’s primary key, or an entry that matches the
Requirement primary key value in a table to which it is related (every non-null
foreign key value must reference an existing primary key value).
Flags
Special codes used to indicate the absence of some value
Constraints
NOT NULL constraint: placed on a column to ensure that every row in
the table has a value for that column
UNIQUE constraint: restriction placed on a column to ensure that no
duplicate values exist for that column
Relational Theoretical way of manipulating table contents using relational
Algebra
operators
Relvar
variable that holds a relation
Heading contains the names of
the attributes
Body contains the relation
yields
PRODUCT
PRODUCT
Yields all possible
pairs of rows from two
tables
Relational Joins allow information to be
Set Operators intelligently combined from two or
more tables
Natural join
Equijoin
Theta join
Inner join
Outer join
Left outer join
Right outer join
Natural Join
Links tables by selecting only the rows with
common values in all their common
attributes (three step process)
Given:
Table name : CUSTOMER Table name : AGENT
Natural Join
Step 1 : Product
Natural Join
Step 2 : Select only common attributes with equal values
Given:
Table name : CUSTOMER Table name : AGENT
Equijoin
Links tables on the basis of an equality condition that compares
specified columns of each table
Given:
Table name : CUSTOMER Table name : AGENT
Outer Join
Matched pairs are retained and unmatched values in the other table are left null
Given:
Table name : CUSTOMER Table name : AGENT
Outer Join
Matched pairs are retained and unmatched values in the other table are left null
Given:
Table name : CUSTOMER Table name : AGENT
Divide
Uses one double-column table as the dividend and one single-column table
as the divisor
Output is a single column that contains all values from the second column
of the dividend that are associated with every row in the divisor
Example:
yields
DIVIDE
Data Dictionary
Description of all tables in the database created by the user and designer
Many-to-many (M:N)
Implemented by creating a new entity in 1:M
relationships with the original entities
Composite entity (i.e., bridge or associative entity):
helps avoid problems inherent to M:N relationships
and includes the primary keys of tables to be linked
THE 1:1 RELATIONSHIP BETWEEN PROFESSOR AND
Relationships within
DEPARTMENT
the Relational
Database
High-level insert,
7 The database must support set-level inserts, updates, and deletes.
update, and delete
Distribution The end users and application programs are unaware of and
11
independence unaffected by the data location (distributed vs. local databases).
If the system supports low-level access to the data, users must not
12 Nonsubversion
be allowed to bypass the integrity rules of the database.