DB-Lecture3_ch03.ppt
Database Principles: Fundamentals of Design, Implementations and Management
CHAPTER 3
Relational Model Characteristics
Objectives
In this chapter, you will learn:
That the relational database model offers a logical view of data
About the relational model’s basic component: relations
That relations are logical constructs composed of rows (tuples) and columns (attributes)
That relations are implemented as tables in a relational DBMS
About relational database operators, the data dictionary, and the system catalog
How data redundancy is handled in the relational database model
Why indexing is important
*
A Logical View of Data
Relational model
Enables the programmer to view data logically rather than physically
Table
Has structural and data independence
Resembles a file conceptually
Relational database model easier to understand than its hierarchical and network database predecessors models
Table also called a relation because the relational model’s creator, Codd, used the term relation as a synonym for table
*
Tables and Their Characteristics
Logical view of relational database based on relation
Relation thought of as a table
Think of a table as a persistent relation:
A relation whose contents can be permanently saved for future use
Table: two-dimensional structure composed of rows and columns
Persistent representation of logical relation
Contains group of related entities = an entity set
*
Properties of a Relation
*
Example Relation / Table
*
Attributes and Domains
*
Each attribute is a named column within the relational table and draws its values from a domain.
The domain of values for an attribute should contain only atomic values and any one value should not be divisible into components.
No attributes with more than one value are allowed.
Degree and Cardinality
Degree and cardinality are two important properties of the relational model.
A relation with N columns and N rows is said to be of degree N and cardinality N.
The degree of a relation is the number of its attributes and the cardinality of a relation is the number of its tuples.
The product of a relation’s degree and cardinality is the number of attribute values it contains.
*
Relational Schema
A relational schema is a textual representation of the database tables, where each table is described by its name followed by the list of its attributes in parentheses.
Keys
A key consists of one or more attributes that determine other attributes
Primary key (PK) is an attribute (or a combination of attributes) that uniquely identifies any given entity (row)
A Key’s role is based on determination
If you know the value of attribute A, you can look up (determine) the value of attribute B
*
*
Keys (cont..)
Relational Database Keys (cont….)
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 redundancies and without unnecessary attributes
Ex: Stud_ID, Stud_lastname
*
Keys (cont..)