Relational vs Non-Relational Databases

Joseph Sasson
2 min readSep 13, 2021

--

A database is where a user stores data, usually on the back end to use through external applications rather than storing it in the application program itself. Databases can be manipulated through commands and can be relational or non-relational.

Relational Database

A Relational Database or SQL Database is a database that stores your information in tables and rows, or records as they are referred to. The term relational database comes from the use of Keys to link together two tables. A Primary key is unique identifiers that help connect the tables together. When you use a primary key, the connecting key is called a foreign key and together they form a relationship across the tables.

There are tons of relational databases including SQLite, MySQL, and PostgreSQL, they are also used by major companies such as Amazon, Google, Microsoft, Snowflake, and many more.

Some key rules to keep the integrity of a SQL database:

  • Use foreign keys and primary keys to connect the tables.
  • When a primary key’s table is deleted all relational tables, information connecting to the primary table are also deleted.
  • When a primary key’s table is changed, all relational tables information connecting to the primary table also need to be changed.
Relational Database using foreign keys

Non-Relational Database

A Non-Relational Database or NoSQL is a database that doesn’t use tables, rows, or keys to store and connect information, instead it uses a storage model. The four popular types of data in a non-relational database are document data, column-oriented data, key-value data, and graph data. These can even be used together in a single application.

  • Document Data is mainly stored as strings and objects in JSON documents.
  • Column Oriented Data is stored in columns which is similar to a relational database but uses columns instead of tables and rows.
  • Key-Value Data is the most basic and is stored as the name says, in key-value pairs within an object.
  • Graph Data is the most complex and uses object relational mapping (ORM) to query the information, the more popular languages to use ORM are Java, JavaScript, .NET, and PHP.

The more popular NoSQL databases are MongoDB, Apache Cassandra, Redis, Couchbase and Apache HBase, and are also used by major companies such as Amazon, Adobe, Qualcomm, and many more.

--

--