Non Relational Database Example

Introduction

There can be quite a bit of confusion about non relational databases especially since the term “non relational database” doesn’t really define what it is, but what it isn’t. We’ll quickly cover what a non relational database is and then we’ll go over some of the technologies and how it’s different and consider some of the advantages.

Relational vs. Non Relational Databases

Let’s talk about what a relational database so we can define what a non relational database is.

A relational database structures all it’s data into tables. Each table is like an Excel spreadsheet with rows and columns of data.

Here is an example of a table in a relational database:

idnamepricequantitydepartment
1Whole Milk1.9912Dairy
2Almonds3.39112Nuts
3Chocolate Bar0.9999Candy

Now let’s take a look at how this data might look in a non relational database:

[{
    id: 1,
    name: "Whole Milk",
    price: 1.99,
    quantity: 12,
    department: "Dairy"
},
{
    id: 2,
    name: "Almonds",
    price: 3.39,
    quantity: 112,
    department: "Nuts"
},
{
    id: 3,
    name: "Chocolate Bar",
    price: 0.99,
    quantity: 99,
    department: "Candy"
},

This is the same data but notice that there are no longer rows and columns.

What’s Different?

So there are some key differences here. In a non relational database or NOSQL database every entry does not have to have the same keys. So if I wanted to add a new product I could add this with no problem:

{
    id: 4,
    name: "New Soda Pop",
    rating: 10
}

Notice that this new item does not have a price, quantity, or department. It was added without those fields. Also it has a new key of “rating” which was not there before. This is a key difference, the relational database relies heavily on a schema that defines the fields beforehand where as non relational databases allow the fields to be different for each record. This adds huge flexibility. The NoSQL non relational databases for this reason are considered to be semi-structured.

One of the reasons you might want to use NoSQL is that it can be easier to store all your data in single record rather than joining several tables together to get the data you need.

Another reason you might use a non relational database is that it’s better at scaling horizontally. Scaling horizontally means that instead of increasing the capacity of a server, you simply add more servers.

The Technologies

Let’s go over some of the common technologies that use each type of database system:

Relational – The most common relational database management systems (RDMBS) or SQL database technologies are: PostgreSQL, MySQL, and Microsoft SQL Server.

Non Relational – The most common non relational database management systems or NoSQL database technologies are: MongoDB, Cassandra, DocumentDB, and Cassandra.

Conclusion

We hope that our explanation and example of a non relational database helped you understand what it is and how it’s very different and has some advantages that make it extremely valuable with today’s technology especially in how it can scale.

If you want some advice on database technology or want to put your existing data in the hands of experts, don’t hesitate to reach out to us at Object Rocket to discuss your situation. Thank you for your time.

Pilot the ObjectRocket Platform Free!

Try Fully-Managed Redis,
MongoDB & Elasticsearch

Get Started

OR

Try CockroachDB
in Beta

Get Started

Keep in the know!

Subscribe to our emails and we’ll let you know what’s going on at ObjectRocket. We hate spam and make it easy to unsubscribe.