Home Programming What is NoSQL?

What is NoSQL?

714
0
no sql

NoSQL (aka “non-SQL” or “non-relational” or “not only SQL”) database store data differently than relational tables i.e. not in tabular form. The main types are document, key-value, wide-column, and graph.

Most people think that NoSQL databases or non-relational databases don’t store relationship data well. NoSQL databases can store relationship data—they just store it differently than relational databases do. In fact, when compared with SQL databases, many find modeling relationship data in NoSQL databases to be easier than in SQL databases, because related data doesn’t have to be split between tables.

NoSQL data models allow related data to be nested within a single data structure. Let us see an example

In RDBMS if we want to show the relationship between two tables then we include the primary key of one table into another as a foreign key, in the below image we have shown a relationship between Employee and Address by including the primary key of address in the employee as address_fkid.

In NoSQL if there is one to one mapping then we embed the data of one table into another

{
	"id": 1,
	"name": "Amit Khurana",
	"phoneNummber": "1234567890",
	"address": {
		"id": 1,
		"streetName": "L-91, Rajouri Garden",
		"city": "New Delhi",
		"state": "Delhi",
		"pinCode": "110027",
		"country": "India"

	}
}

This makes retrieval faster because if we need the details of both Employee and address then we have to use join in RDBMS but in NoSQL there is no need to use join.

There are many different vendors who provide NoSQL service like mongoDB, Amazon DynamoDB, Azure CosmosDB, etc.

In next article we will learn about the advantages and disadvantages of NoSQL.

This site uses Akismet to reduce spam. Learn how your comment data is processed.