What is the relational data model?

Overview

Simply speaking, a data model is the blueprint of any database system. Several types of data models exist if we consider the history and the evolution of database systems throughout the ages. To name a few, we have:

  • Network data model
  • Hierarchical data model
  • Relational data model

In today's database market, the relational data model is the one that is prevalent precisely due to the notion of data independence it brought out in the evolution of database management systems. Let's learn about it in this shot.

Relational data model

The relational data model is based on sets theory and predicate calculus. As mentioned earlier, it offers better data independence by:

  • Storing the data in a simple data structure (tables)—logical data independence
  • Accessing it through a high-level set-at-a-time Data Manipulation Language (DML)—physical data independence
  • Being independent of physical storage

This is how we can view the relational data model:

The big picture of the relational database model

The relational terminology

Let’s define each of the terms in the image above.

  • Relation (or table): A subset of the Cartesian product of a list of domains characterized by a name.
  • Attribute (or column or field): A property of a relation or, more precisely, the primary storage units. It needs to have a relevant name. For example, given a Person's association, available attributes can be name, sex, date of birth, etc.
  • Domain: A set of acceptable values that an attribute is allowed to contain. For example, the "Marital Status" domain has many possibilities: married, single, divorced.
  • Tuple (or row or record): Contain fields that are related.
  • Schemas: A formal description of all the database relations and their relationships.
  • Keys: Identifiers for a relation’s tuples. We have a primary key which is the attribute that is chosen to represent the relation, and a foreign key which is the attribute that refers to the primary key in another relation.
  • Degree (relation): Number of attributes in a relation.
  • Cardinality (relation): Number of tuples in a relation.

The relational data model constraints

Data integrity is essential for a database. To achieve this, every DBMS implements rules or constraints that the users must respect to ensure that the result is always in a correct state.

Let's see what those rules are:

  • Entity integrity constraint: A primary key (PK) is not allowed to accept null values.
  • Referential integrity constraint: Every value of a foreign key must either be equal to the value of PK or be wholly null.
  • Semantic integrity constraint: Refers to the correctness of the meaning of the data. For example, student age must be positive.

Math operations

Relational algebra is a set of operators to manipulate relations. Each relational algebra operator takes either one or two relations as its input and produces a new relation as its output. Such operators are:

  • Traditional set operations: union, intersection, difference, and Cartesian product.
  • Special relational operations: select, project, join and divide.

On the other hand, relational calculus represents an alternative to relational algebra as a candidate for the manipulative part of the relational data model.

Conclusion

This shot was about the relational data model, the most widely used in today's database. Here's a recap of what we learned so far:

  • Basic concepts, including essential terminology
  • Integrity constraints
  • Relational algebra and relational calculus

Free Resources