Relational vs Non-Relational Databases

I am by no means an expert on databases but if you are starting a project, there is always questions to ask about said project that can be answered in making user stories, flow-charts, objectives, constraints and so, but one of the most important parts of any application is how you store data. That’s where based one the purpose and nature of your application will determine whether to use a relational or non-relational database, and I hope to define what it is, and what the advantages and disadvantages of each are and when they should be used.

Relational Database

            A relational database if you could have guessed is a database based on the relational model of data. Where each database is a collection of tables each with defined and finite data where that data is related to one another. Each table columns where it can have multiple data types, for example if you were storing customer information, you’d have a customer table like this with your columns organized First name, Age, Date of birth, all three can be different datatypes. Relational databases most commonly use a structured query language or commonly called SQL to access the tables this is a high-level language where you nest statements and in almost plain English tell the database what to give you in return. Some examples of common relational databases are MySQL, PostgreSQL, and SQLite.

Non-relational Database

            Non-relational again if you could have guessed are just databases that do not relate. Data is not structured in rows and columns but are more stored as a collection, more specifically usually in some form of JavaScript Object Notation or more commonly known as JSON but they can usually import formats. The language non-relations databases use again predictably is called NoSQL which acts the same as SQL in the sense that it is used to write and read to databases but works to find key value pairs rather than finding specific table and values. Non-relational databases have dynamic schema meaning they do not have predetermined schema so a value (“column”) can be added whenever you want, where for relational you can only add new inputs to a table (rows). This makes relational databases vertically scalable and non-relational horizontally scalable. Examples of non-relational databases are MongoDB, CouchDB, and Redis.

Advantages and Disadvantages of Both           

Overall after learning what both database types are its pretty clear to see where one would be a much better than the other. Relational databases are great for having a predetermined schema, and data that relates to each other. But keeping these relations up to date and making sure they can match up can be difficult for some applications at full scale especially for huge application with data stored in many different locations. Usually larger amount of data you must store in different tables the more likely you should be using a non-relational database but if your database is relatively few tables and relies a lot on how the data is connected the relational database is a great choice. As a relational database adds a lot of functionality a non-relational can’t with having automatic joins and verifications, where a lot of these action must be manually done on a non-relational database. In conclusion there is both advantages and disadvantages to both but it’s about finding the right balance to figure out which database is best for your applications.

Sources:

  1. https://www.pluralsight.com/blog/software-development/relational-non-relational-databases#:~:text=Relational%20databases%20like%20MySQL%2C%20PostgreSQL,in%20collections%20of%20JSON%20documents.
  2. https://en.wikipedia.org/wiki/Relational_model

Leave a comment

Design a site like this with WordPress.com
Get started