Relational DBMSs



index
Disabled back button Next Section
printable version

Section 0: Module Objectives or Competencies
Course Objective or Competency Module Objectives or Competency
The student will be able to list and explain the terminology, concepts, and basis of relational databases. The student will be able to list and explain database terminology like entities, attributes, and tables or entity sets.
The student will be able to explain the functional dependencies and how the concept is used to determine how a primary key is selected to uniquely identify all other attribute values in any given row.
The student will be able to design foreign key to primary key linkages between two database tables.
The student will be able to demonstrate the use of entity integrity and referential integrity to ensure that the data in a database is accurate, valid, reliable, and consistent.
The student will be able to explain how relationship classifications factor into database design.
The student will be able to explain what a system catalog is and how it is vital to a relational database.
Section 1: Overview

Database Fundamentals






The design of relational databases focuses on entities and their attributes.

An attribute represents a characteristic of an entity.

Tables

Recall that a relational database is perceived by the user as a collection of tables in which data are stored.

Each table consists of a series of row/column intersections.

Table Details.

Table Details

A table contains a group of related entities.

Since a table contains a group of related entities it is sometimes called an entity set, or a relation.

Remember that each row, or tuple, represents a single entity. In the table above each tuple represents a single agent out of the entire group of agents.

Each column, or attribute, must have a unique name.

The order of the rows and columns is unimportant.

Section 2: Dependency and Keys

Functional Dependence

Functional dependence means that the value in column A determines the value in column B (the value in column B depends on some value in column A).

Here is an example:

Example relation.

Fully Functionally Dependent

If the attribute (B) is functionally dependent on a composite key (A) but not on any subset of that composite key, the attribute (B) is fully functionally dependent on (A).

Keys

There are several types of keys.

When designing a table, or entity set, the designer must identify a primary key that will uniquely identify each entity.

The designer begins by identifying viable superkeys, then from those selecting candidate keys, and from those selecting a primary key.

Superkey

A superkey is an attribute (or combination of attributes) that uniquely identifies each entity in a table.

Candidate Key

A candidate key is a minimal superkey, i.e., it does not contain a subset of attributes that is itself a superkey.

Primary Key

A primary key is a candidate key selected to uniquely identify all other attribute values in any given row.

Composite Key

It may require more than a single attribute to define functional dependence, i.e., a key may be composed of more than one attribute.

Secondary Key

A secondary key is an attribute (or combination of attributes) used strictly for data retrieval purposes.

Foreign Key

A foreign key is the primary key of one table that has been placed into another table to create a common attribute by which they can be linked..

Section 3: Linking Tables

The ability to link, or JOIN, tables is the power behind relational databases.

Tables, or relations, are related to each other by sharing a common entity characteristic.

Linking Tables.

Linking Tables

Links are created by having two tables share a common field.

Controlled Redundancy

Controlled redundancy refers to the way in which tables in the database share common attributes that enable the tables to be linked together.

In the table above, the CUSTOMER table may contain an agent's AGENT_CODE that corresponds to an entry in the AGENT table.

The relational model uses controlled redundancy to avoid the widespread redundancies found in file systems.

Section 4: Integrity Rules

Database integrity ensures that data entered into the database is accurate, valid, reliable, and consistent.

Integrity rules are the rules that must be enforced to ensure the accuracy and accessibility of a relational database.

Integrity rules are imperative to a good database design. Most RDBMS have these rules automatically, but it is safer to apply the rules in the design phase.

Entity Integrity

Requirements – no null entries in a primary key; all entries are unique.

Purpose – guarantees that each entity will have a unique identity.

Example – No invoice can have a duplicate number, nor can it be null. (All invoices are uniquely identified by their invoice number.)

Consequences of violating entity integrity: If multiple tuples have duplicate or unspecified primary key values, it might not be possible to locate data for a specific entity, leading to data conflict between tuples, and joins to another table via identical values in their common attribute would result in ambiguous linkages to possibly unrelated tuples.

Referential Integrity

Requirements – foreign key must have either a null entry or an entry that matches the primary key value in a table to which it is related.

Purpose – makes it impossible for an attribute to have an invalid entry, although it is possible for the attribute NOT to have a corresponding value.

Example – A customer might not yet have an assigned agent (AGENT_CODE), but it will be impossible to have an invalid agent (AGENT_CODE).

Consequences of violating referential integrity: If a tuple in table 2 has a foreign key for which there is no corresponding primary key in related table 1, the relation to which a foreign key refers does not exist and joining the tables together would cause tuples in table 2 with the unmatched foreign key to be left out of the results.

Illustration

Illustration of Database Integrity.

Illustration of Database Integrity

Entity Integrity

Referential Integrity

Section 5: Relationships

A relationship describes an association among entities.

Relationship classifications include the following:

Section 6: System Catalog

A data dictionary provides a detailed accounting of all tables found within the database.

System Catalog

The system catalog is a very detailed system data dictionary that describes all objects within the database, including:

Notes:

A Sample Data Dictionary.

A Sample Data Dictionary

Read more about the importance of system catalogs.

Section 7: Database Software

Best Relational Databases Software in 2020