A Guide to Understanding Databases: Relational vs NoSQL.

Sanjay Prasad
6 min readFeb 10, 2023

--

  1. What is a Database?

1.1 Definition and purpose of Database

1.2 Types of Databases

2. Relational Databases

2.1 Structures and Features

3. NoSQL Databases

3.1 Advantages and Disadvantages

3.2 Types of NoSQL Databases

4. Difference Between Databases and Spreadsheets

5. When to use NoSQL Databases

5.1 Scenarios and conditions

5.2 Benefits of using NoSQL Databases

1. What is a Database?

1.1 Definition and Purpose of Database

Ranjeet our protagonist from the first blog post what is Data Science? How is it impacting our life? started collecting the data from his mobile for an awesome project but soon he realized that he needed a way to organize it all. After doing a few online searches, reading and discussions, he learned about databases.

A database is a system used to store data. A database can be a cloud database, or a local database and it is an organized collection of data, stored and accessed electronically. It is designed to allow efficient storage, access, and manipulation of data. It is used to store any type of data like text, numbers, and multimedia content, and can be used by anyone either an individual or an organization.

Database system sounds very interesting to him, and it is, but he knows storing data is not a new practice. For a very long time, we are maintaining the information and it is the same thing, the only difference is now our data is changed and our methods become more efficient and electronic.

source : Data Blockchain Honeycomb — Free image on Pixabay

The definition of the database from Oracle.com states that,

“A database is an organized collection of structured information, or data, typically stored electronically in a computer system.” — Oracle.com

1.2 Types of Databases:

Excited about finding a way to his problem, he started reading about databases and came to know about their types.

There are two types of databases.

  1. Relational Database
  2. NoSQL Database

As he learned about both of them, he soon realizes both of them as two competing candidates fighting for his affection.

2. Relational Databases

Relational databases reminded him of his old-fashioned, dependable high school sweetheart. Promising him to keep all his data neatly organized in rows and columns, just like a neatly kept school notebook always getting appreciation from the teachers.

2.1 Structure and Features

Relational databases Stores data in form of tables having rows and columns. Multiple tables may have a relation between them that’s why called a relational database. To visualize it one can compare it to a spreadsheet for better understanding but it’s way more powerful and scalable than a spreadsheet. SQL (Structured Query Language) is used to interact with relational databases. SQL is the standard language used to manage relational databases, but one may find slight differences in its syntax for different Relational database management systems (RDBMS) and one may find it in the documentation of different RDBMS systems and can avoid the possible errors and confusion while writing the query for a specific database.

e.g.: MySQL, SQL Server, PostgreSQL, SQLite etc.

3. NoSQL Databases

On the other hand, NoSQL databases are new cool kids, who promised him to handle all of Ranjeet’s data with ease, no matter how much it grew.

NoSQL databases become popular when the cost of storage decreased. they are very different as compared to relational databases. There are many ways to store data and the way how data is getting stored gives rise to different types of NoSQL databases which are using very different approaches to storing data as compared to traditional relational databases.

Each NoSQL database has its unique features, and it allows developers to store a huge amount of unstructured data, which gives them lots of flexibility.

3.1 Advantages and disadvantages

In the end, Ranjeet decided to go with the NoSQL database. Because his needs are more aligned with the features offered by them. It can handle bigger data sets and are more flexible.

Advantages:

  1. Scalability: NoSQL databases are designed to scale horizontally and can easily handle a large volume of traffic.
  2. Flexibility: It allows storage of unstructured data which gives lots of flexibility to developers.
  3. Performance: NoSQL databases are faster as compared to Relational databases and can easily handle real-time data processing.
  4. Cost-effectiveness: NoSQL databases are very cost-effective as compared to relational databases.

Disadvantages:

  1. Data consistency: NoSQL databases may not provide the same level of data consistency as compared to relational databases.
  2. Query capability: Limited query capability as compared to relational databases.
  3. Complexity: It required expertise to set up and manage NoSQL Database.

3.2 Types of NoSQL databases

There are 4 major types of NoSQL databases:

  1. Document Database
  2. Key-Value Database
  3. Wide-column stores
  4. Graph Database

e.g., MongoDB, Cassandra, HBase etc.

4. Difference between Database and Spreadsheets

During learning about databases, he also came across spreadsheets that could also help him in organizing his data and they are simple to use and easy for him to manipulate data. However, he soon realized it was not a good candidate for his project, as spreadsheets had their limitation. Despite all the limitations, it’s still a useful tool for him and like Ranjeet, many organizations still use spreadsheets as a primary tool for data management and analysis.

Databases and spreadsheets both are tools for storing and managing data, but there are some key differences between them.

  1. Structure: Spreadsheet store information in tabular form with rows and columns while databases can use many structures to store data such as tables, document, key-value pairs and graph
  2. Query Language: Spreadsheets use formulas and filtering whereas databases like MySQL use Structured Query Language
  3. Data Size: spreadsheets are limited to a few hundred or thousands of rows of data while databases can handle much larger data.
  4. User: the spreadsheet is designed for a single person to interact with at a time while a database can handle multiple users.

5. When to use NoSQL databases

5.1 Scenarios and conditions.

Even after choosing NoSQL, he still wondered if one day they could find a way to work together, combining the best of two worlds.

Just like Ranjeet, organizations, and independent developers, all face the same dilemma when it comes to choosing the right database for their needs. But in the end, it all comes down to the specific requirements and the nature of the data being stored who knows, one day relational and NoSQL databases will find a way to coexist together in perfect harmony! But according to need any one or both can be used for a project and maybe this is the start of that coexistence.

SQL is in use for a very long time and it’s still very popular it will remain popular always but as the technologies are getting advanced with that structure of data, its shape, volume, interaction with it and frequency of generation of data all are getting change and it is important to choose a database which is fulfilling the needs of an organization and after considering all the pros and cons of both Relational and NoSQL databases one can reach to a conclusion which databases is best suited for a specific use case.

  1. Scenarios like where real-time access to data is of great concern then NoSQL are a better choice as compared to Relational databases which can’t match the speed of NoSQL databases.
  2. With the increase in the volume of data, it is cheaper to manage data using NoSQL databases as compared to Relational databases.

5.2 Benefits of using NoSQL databases.

NoSQL is preferred when.

  • When the amount of data is very huge.
  • There is no strong relation between the data.
  • Data is not structured.
  • The database needs to consistently scale.

Summary

A database is an organized collection of data stored electronically, designed for efficient storage, access, and manipulation of data. There are two types of databases: Relational and NoSQL. Relational databases store data in tables with rows and columns and use SQL (Structured Query Language) to interact with them. NoSQL databases are popular due to their cost-effectiveness, scalability, and flexibility. They can handle a large amount of unstructured data but may have limited query capability and data consistency. There are four types of NoSQL databases: Document, Key-Value, Wide-column stores, and Graph. Databases differ from spreadsheets in terms of structure, query language, data size, user, and data relationships. NoSQL databases are best suited for scenarios where real-time access to data is a concern, and when the volume of data is high.

About the author: Hi, I am Sanjay Kumar Prasad, I’m a Data Science Enthusiast and Mechanical and Automation Engineer Currently Learning Machine Learning/ Deep Learning/ NLP/Computer Vision. You can connect with me on LinkedIn, and for my practical implementation, you can visit my GitHub.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Sanjay Prasad
Sanjay Prasad

Written by Sanjay Prasad

Data science enthusiast & Mechanical and Automation engineer, passionate about insights & innovation, sharing experiences on Medium.

No responses yet

Write a response