DEV Community

Cover image for Study over Joins in sql and nosql databases.
Shashank727663
Shashank727663

Posted on

Study over Joins in sql and nosql databases.

what are joins actually?

lets discuss that first.
As of now, we all know that in SQL databases if there are two tables with a common entity we can perform an algorithm in order to merge both the tables, and as a result we get a new table that consists of the common entities and with some constraints for ex:-(left join, right join,self join) we can preserve the whole data of a table that we choose.
a very typical SQL query for a join is given below

SELECT book.title, publisher.name
FROM book
LEFT JOIN book.publisher_id ON publisher. id;

Enter fullscreen mode Exit fullscreen mode

WHY SQL DATABASES PERFORM JOINS
The reason that SQL databases perform joins is that they form relations between them i.e. they are also called Relational databases. Also, SQL databases use a diagrammatical representation of relationships between entities that are also called E-R DIAGRAMS.

NO SQL databases
A brief Introduction to NoSQL databases
these types of DBS (such as MongoDB,dynamodb, NEO4j, etc) are very useful to build modern-day applications where we are not sure that the data coming from the client-side will always be consistent or not some of the cases where we can use NoSQL DBS are:-

  1. Fraud detection and identity authentication.

  2. iot based systems

and also there are many more cases where we can use NoSQL DBS

How does NoSQL DBS store data and how it's different from SQL DBS?

  • As we know that SQL databases use a table-like structure as discussed earlier in the article

  • but when it comes to NoSQL DBS the data is stored in the form of key-value pairs (collections )
    something of the sort that is given below:-

{
  "_id": ObjectID("45b83bda421238c76f5c1969"),
  "name": "virat",
  "email: "virat@kohli.com",
  "country": "india",

}
Enter fullscreen mode Exit fullscreen mode

Also, NoSQL DBS are also called non-relational databases which means our DBS (entities inside them cannot have relations ) since no relations means that we cant perform join operations(Algorithms).

  • unfortunately, it is not possible to perform a Join into a NoSQL database. This is one of the biggest differences between SQL and NoSQL DBS.

Top comments (0)