NoSQL vs Relational Database
NoSQL vs Relational Database
If you are already working in the analytics domain then you might have heard words like PostgreSQL, MongoDB, MySQL, Oracle, etc. We also do have a fair bit of idea about the fact that we store our tables and databases in these places. But why can’t we have everything under one hood?
We should have heard people saying that ABC is a NoSQL database and we should store these data in it rather than a traditional Relational database, what does that mean?
Does NoSQL mean that you don’t have to write SQL on top of it? If yes, then what is the use?
Let’s try to understand NoSQL vs Relational Database
NoSQL stands for Not Only SQL
Not Only SQL – Every item in the database stands on its own
Relational databases are like predefined table structures where you can surely add as many rows as possible but adding a new column is a pain as you have to change the schema of the table, thus it is a vertically scaling database. Whereas NoSQL is built in such a way that you can add any number of rows but at the same time you can add any additional information pertaining to a row.
Example – Suppose you have an employee table and you have a NoSQL database, in this table, there will be only 2 columns i.e. a primary key and a values column where you can add as many details as possible, for one employee you can add only name and phone number whereas for another employee you can add the complete profile ranging from name to spouse’s work status, how?
In general, the value thing is stored in a JSON format which again is a key-value pair and you can add any number of attributes corresponding to an employe
Relational Database – Vertical scaling Ex. PostgreSQL, SQLite, MySql
NoSQL – Vertical and Horizontal scaling – Each item in the database only has two things – unique key and values
Different formates in which you can store data in your NoSQL database
1. Document Database – JSON
2. Key-Value store
3. Graphical database
How does this scaling makes database life easier?
As discussed, Scaling in NoSQL can work in a horizontal way
Let’s take an example – A company XYZ runs a NoSQL database which has 10000 servers, All these servers work as a partition i.e. your data which you want to fetch is not present in only one server, it can be present in any partition.
Won’t it be too cumbersome for the database to check all the partition to find a detail ?How do find where is the data stored?
NoSQL databases are key-value stores
Itβs not just a key-value pair – It is a key-hash-value where each key is associated with a hash value and this hash value works as a partition identifier π
Suppose the hash value is in the range of 0 to 1000 and all your data is stored in one DB. Now, if you want to double your DB performance, you can add another server, and now
Server 1 – Hash value 0 to 500
Server 2 – Hash value 501 to 1000
This range of 0 to 1000 is called a keyspace. Keyspace tells you where to store new items and where to find the existing ones.
NoSQL is schemaless – anyways you are storing everything in a JSON format and you can increase or decrease the amount of information in each field. In a relational database, you have to define the schema of the table and have to adhere to it
Example of NoSQL –
AWS – DynamoDB
Google Cloud – Big Table
Azure – CosmoDB
You can also run NoSQL DB yourself by using software like Cassandra, CouchDB, MongoDB.
We will try to create a video on the same to give a glimpse of what is JSON and NoSQL
The Data Monk services
We are well known for our interview books and have 70+ e-book across Amazon and The Data Monk e-shop page . Following are best-seller combo packs and services that we are providing as of now
- YouTube channel covering all the interview-related important topics in SQL, Python, MS Excel, Machine Learning Algorithm, Statistics, and Direct Interview Questions
Link β The Data Monk Youtube Channel - Website β ~2000 completed solved Interview questions in SQL, Python, ML, and Case Study
Link β The Data Monk website - E-book shop β We have 70+ e-books available on our website and 3 bundles covering 2000+ solved interview questions. Do check it out
Link β The Data E-shop Page - Instagram Page β It covers only Most asked Questions and concepts (100+ posts). We have 100+ most asked interview topics explained in simple terms
Link β The Data Monk Instagram page - Mock Interviews/Career Guidance/Mentorship/Resume Making
Book a slot on Top Mate
The Data Monk e-books
We know that each domain requires a different type of preparation, so we have divided our books in the same way:
1. 2200 Interview Questions to become Full Stack Analytics Professional β 2200 Most Asked Interview Questions
2.Data Scientist and Machine Learning Engineer -> 23 e-books covering all the ML Algorithms Interview Questions
3. 30 Days Analytics Course β Most Asked Interview Questions from 30 crucial topics
You can check out all the other e-books on our e-shop page β Do not miss it
For any information related to courses or e-books, please send an email to [email protected]