What is a Relational Database?

A relational database is a type of database that stores and provides access to data points that are related to one another.

Relational databases are based on the relational model, an intuitive, straightforward way of representing data in tables. In a relational database, each row represents a set of related data, and every row in the table has the same structure. The columns represent categories of data (such as name or email), and each entry in the column has the same type of data (such as text or integer). Together, the columns and rows create a table.

The relational model is so important because it forms the basis for SQL (pronounced "sequel"), which stands for structured query language. SQL is a computer language that lets you perform powerful queries and operations on data stored in databases. If you want to read from or write to a database, you have to use SQL. It's not really possible to use a relational database without using SQL, which gives you an idea just how important this data model is.

How does a Relational Database work?

A relational database is a digital database based on the relational model of data, as proposed by E. F. Codd in 1970. The various software systems used to maintain relational databases are known as a relational database management system (RDBMS). Virtually all relational database systems use Structured Query Language (SQL) for querying and maintaining the database.

Relational databases have replaced legacy hierarchical databases and network databases because they are easier to understand and use. Relational databases are organized into tables, which consist of rows and columns, with a unique key identifying each row. Each entry in the table has its own unique key, or primary key. It is common practice to give each table a name that reflects its contents.

How Relational Databases are structured

The columns of the table represent different attributes or fields of the object described by the table, such as customer name or telephone number. Each row in the table represents an instance of an object, such as a particular customer or telephone number.

Each item of data is stored as a row in a table, and all rows with a common feature are stored together in the same table. One or more columns of the table may be designated as identifiers; these have unique values for each row and are used to establish relations between different tables.

For example, in a table that contains employee data such as names and salaries, employees' names might be designated as identifiers.

A related table containing departments might use names to identify each department — Sales, Marketing, etc. A query can then show employees' names alongside their department names by matching the identifier values in both tables.

Relational Databases and ACID Properties

Relational database transactions are characterized by four properties: atomicity, consistency, isolation, and durability, also known as ACID properties. As per oracale.com:

  • Atomicity defines all the elements that make up a complete database transaction.
  • Consistency defines the rules for maintaining data points in a correct state after a transaction.
  • Isolation keeps the effect of a transaction invisible to others until it is committed, to avoid confusion.
  • Durability ensures that data changes become permanent once the transaction is committed.