A relational database is a collection of data points with pre-defined relationships between them.

The relational model organizes data into tables — with each row representing an individual record and each column consisting of attributes that contain values. This tabular database structure makes it easy to establish relationships between data points so that the information can be accessed in a variety of different ways without reorganizing the data itself.

You can join the tables in a relational database to gain deeper insights into the interconnection between diverse data points. For example, the table customer has columns name and address with row values John and California. Similarly, the table product has columns name and cost with row values shoes and $12. You join the customer table with the product table to identify popular products that customers purchase more frequently.

In short, a relational database is a way to store and access data with pre-defined relationships.

What is a relational database management system

A relational database management system (RDBMS) is a software layer of tools and services that manages relational tables. In practice, the terms RDBMS and relational database are considered to be synonyms. A relational database provides a consistent interface between applications, users, and relational database. Organizations use RDBMS for managing large amounts of business critical information from various departments.

Multiple users can work with the same database in different ways. For example, they can perform database operations and aggregate key data points without creating data redundancy. Relational database management systems also give your database administrator greater access control over your data.

Why are relational databases important

Since the invention of computers, managing and storing data on machines has been an ongoing field of research. Before relational databases, organizations used a hierarchical database system, similar to folders on your computer. These early database systems could organize large volumes of data. However, they were limited in how you could uncover data relationships. They were also complex, proprietary to particular applications, and required technical expertise to work with.

The relational database model emerged as a solution to these problems. It separated physical data storage from database management and usage. Modern relational databases let users store and retrieve data without having to manage physical data storage. You can also manipulate logical data structures programmatically.

What are the benefits of a relational database

The primary benefit of the relational data model is the ability to derive meaningful information from data. For example, you can count, sort, and group data in a table, as well as perform mathematical operations and generate complex reports. Hence, relational database systems remain the most popular for data storage today. We give some more benefits below.

Data integrity

Data integrity is the overall completeness, accuracy, and consistency of data. Relational databases use a set of constraints to enforce data integrity in the database. These include Primary Key, Foreign Key, ‘Not NULL’ constraint, ‘Unique’ constraint, ‘Default’ constraint, and ‘Check’ constraints.

These integrity constraints help enforce business rules on data in the tables to ensure the accuracy and reliability of the data. In addition to these, most relational databases also allow custom code to be embedded in triggers that execute based on an action on a data point in the database. Custom code can also be embedded in stored procedures that executes when they are invoked by a client or application.

Security

Most relational database management systems have sophisticated access controls. Your database administrators can precisely determine who gets what access to which data. You can limit access to read, modify, and delete data even at the individual cell level. Such granular access control makes relational databases very secure.

Backup and disaster recovery

Most relational databases have import and export functionality, so you can quickly create data backups. Modern, cloud-based relational databases perform continuous mirroring so you can restore lost data in seconds or less.

Community support

Several relational database technologies are open source and free to use. Open source databases have active communities continuously improving and adapting features and functions. Developers and data engineers can access various tools and software that make relational databases very convenient to use.

How do relational databases work

Relational databases work by providing an environment from which applications access data and reassemble it in various ways without having to reorganize the data tables from within the application code. We give some key features of a relational database system below.

Data model

The relational database is made of tables that represent real-world objects or concepts often referred to as entities. Each column in a table holds a certain kind of data known as an attribute, and a field stores the actual value of an attribute. The rows and columns in the table represent a collection of related values of one object or entity.

You can mark each row in a table with a unique identifier called a primary key. A foreign key references the primary key of another existing table and creates a logical connection. Rows among multiple tables thus relate together using a primary key/foreign key pairing. For example, each row of an orders table can contain a foreign key that contains the customer ID, which identifies the row in the customer table that contains all the information about the customer.

SQL

Structured Query Language (SQL) is the primary interface to communicate with relational databases. SQL became a standard of the American National Standards Institute (ANSI) in 1986. All popular relational database engines support the standard ANSI SQL. You can use it to update, delete, or store data, retrieve data subsets, and manage all aspects of your relational database.

SQL is fairly easy to learn as it uses common English keywords in its statements. It also integrates well with different programming languages. For example, you can embed SQL queries with the Java programming language to build high-performing data processing applications with major SQL database systems.

Transactions

A relational database transaction is one or more SQL statements that run as a sequence of operations and form a single logical unit of work. Transactions provide an "all-or-nothing" proposition, meaning that the entire transaction must complete as a single unit. If the relational database management system cannot complete any part of the transaction, none of the individual components go through. In the relational model terminology, a transaction results in a COMMIT or a ROLLBACK. The database management system treats every transaction coherently and reliably, independent and isolated from other transactions.

ACID compliance

All relational database transactions must be Atomic, Consistent, Isolated, and Durable (ACID) compliant to ensure data integrity.

Atomicity
Atomicity requires that the transaction as a whole should execute successfully. If a part of the transaction fails, then any changes that were made as part of the transaction are rolled back.

Consistency
Consistency requires that the data written to the relational database as part of the transaction must adhere to all defined rules and restrictions, including constraints, cascades, and triggers.

Isolation
Isolation requires that each transaction is independent unto itself. When multiple users attempt to modify data in a relational database simultaneously, concurrency control mechanisms prevent them from overwriting each other's changes.

Durability
Durability requires that all the changes made to the relational database be permanent once a transaction is successfully completed.

What are the different types of databases

There are many different types of databases that are designed to optimize flexibility and scalability for certain data models. These database types include:

  • Relational: Data is stored in a tabular format using rows for individual records and columns to store attributes or data points related to the records.
  • Key-Value: Data is stored in a dictionary format with each item having a key and value.
  • Document: Data is stored as documents using JSON, XML, or another format for semi-structured data.
  • Graph: Data is stored as a knowledge graph using nodes, edges to define the relationship between these nodes, and properties that store individual data points.

What is the difference between relational and non-relational databases

The difference between relational and non-relational (also known as NoSQL) databases has to do with the structure of the data they contain. A relational database model organizes the data into tables, indexes, and views. This tabular structure makes it easy to create, read, modify, and delete relevant data using a querying language like SQL. The structure of each row is the same, much like a spreadsheet.

A non-relational database does not use a tabular data structure. Instead, the data may be stored as key-value pairs, JSON, graph, or nearly any other type of data structure. Many non-relational databases are also called NoSQL databases because the data is stored and queried in a way that doesn't require SQL.

Non-relational databases, or NoSQL databases, are purpose-built for specific data models and have flexible schemas for building modern applications. They are widely recognized for their ease of development, functionality, and performance at scale. Some points of difference include:

Data storage mechanism

Relational databases store structured data in rule-based rows and columns. Conversely, NoSQL databases store individual data elements in separate files.

Flexible structure

Relational databases store data in tabular form and follow strict rules concerning data variety and table relationships. Non-relational databases offer more flexibility because they do not require structured data. You can use them to store files, videos, and other unstructured content.

Data integrity mechanism

A relational database model follows strict ACID properties. Traditionally, non-relational databases offer a more flexible BASE (Basically Available, Soft state, Eventual consistency) model. They guarantee availability but not strong consistency. The database state can change over time and eventually becomes consistent. Modern non-relational databases also offer ACID, strong consistency, high availability, and more.

What should you look for when selecting a relational database

Relational database use cases can vary depending on the type and volume of data that’s being stored as well as the level of performance required to access it. That’s why a variety of relational database engines have been developed — from Amazon Aurora, Oracle, and Microsoft SQL Server to MySQL and PostgreSQL — each with its own advantages and disadvantages.

When selecting a relational database, it’s important to consider whether you’ll need to find a managed cloud service provider that supports it. Amazon Relational Database Service (RDS) is a fully managed database service that handles provisioning, patching, backups, and other essential tasks for the most popular relational databases. This means you can choose a database engine that meets your use case without worrying about its maintenance requirements.

How can AWS support your relational database management system requirements

Amazon Relational Database Service (Amazon RDS) is a collection of managed services that makes it simple to set up, operate, and scale a relational database in the cloud. Cloud databases offer many benefits like performance, scale, and cost efficiency. We give some examples of relational database engines on Amazon RDS below.

Amazon Aurora
Amazon Aurora is a MySQL and PostgreSQL-compatible relational database engine. It combines the speed and availability of high-end commercial databases with the simplicity and cost-effectiveness of open-source databases. Amazon Aurora provides up to 5x the throughput of MySQL and 3x the throughput of PostgreSQL at one-tenth the cost of commercial databases.

Oracle
Amazon RDS for Oracle allows you to deploy multiple editions of Oracle Database in minutes with cost-efficient and resizable hardware capacity. You can bring existing Oracle licenses or pay for license usage by the hour. RDS manages complex database administration tasks, including provisioning, backups, patching, monitoring, and hardware scaling, so that you are free to focus on application development.

Microsoft SQL Server
Amazon RDS for SQL Server makes it easy to set up, operate, and scale SQL Server in the cloud. You can deploy multiple editions of SQL Server, including Express, Web, Standard, and Enterprise. Since Amazon RDS for SQL Server provides you direct access to the native capabilities of the SQL Server, your applications and tools should work without any changes.

MySQL
MySQL is an open-source relational database management system used by a very large number of web-based applications. Amazon RDS for MySQL gives you access to the capabilities of a familiar MySQL database engine. This means that the code, applications, and tools you already use with your existing databases can be used with Amazon RDS without any changes.

PostgreSQL
PostgreSQL is an open-source, object-relational database system with an emphasis on extensibility and standards compliance. Amazon RDS for PostgreSQL manages undifferentiated time-consuming database administrative tasks such as PostgreSQL software installation, storage management, and upgrades. You can deploy and get started within minutes.

MariaDB
MariaDB is a MySQL-compatible database engine that is a fork of MySQL. It was developed by the original developers of MySQL. Amazon RDS for MariaDB makes it easy to set up, operate, and scale MariaDB deployments in the cloud. With Amazon RDS, you can deploy scalable MariaDB databases in minutes with cost-efficient and resizable hardware capacity.

Get started with your relational database on AWS by creating a free account today!

Deep dive into Amazon Aurora and its innovations
Amazon Aurora HA &DR design patterns for global resiliency