DEV Community

Naitik Pitroda
Naitik Pitroda

Posted on

MongoDb Vs Sql

Author @naitik_pitroda

#Explaining in very simple language to beginner's.

To understand this database languages. Let me give two pics which can clear your vision.

SQL

Alt Text
Show's SQl database(structured data Eg:1)

  • It's very easy to find data when it's structured & organized in a good manner, which we can see in SQL. It's quiet tough to find data in a unstructured manner. We can easily find out book in this room.

  • In SQL databases, data is stored in form of traditional 2 dimensional row-column structure

  • Relational database: E.g. EmployeeID column which would be a primary key of Employee table would be present as a foreign key in the Payments table, thus connecting the two tables with the referential property. This relationship ensures that there is no payment entry of an employee whose details are not present in the master Employee table. This is why SQL databases like MySQL are also called relational databases.

  • The architecture of SQL databases like MySQL is governed by the principles of ACID property.

ACID stands for Atomicity, Consistency, Isolation, and Durability. These properties focus on the consistency and reliability of the transaction done in the database.


MongoDb

Alt Text
Show's MongoDB database(unstructured data Eg:2)

  • It's difficult to find data when it's unstructured & improper, . It's quiet tough to find data in a unstructured manner. Like finding book in this pic.
  • In MongoDB rich data document model is followed, which allows storage of any type of data and fast working.
  • On the other hand, in MongoDB, we cannot establish such a relationship between the unstructured data of the collections. Hence it is considered as a non-relational database
  • MongoDB is built on the principles of CAP Theorem which focuses on Consistency, Availability, and Partition. Unlike the ACID properties of SQL databases, CAP theorem focuses on availability of data in the case of MongoDB.

Personally, suggested to start with SQl then create some basic projects using it. Afterwards move to MongoDb for advance level and for full stack development. SQL is easy to learn and code compare to MongoDb. Begineer's should start with SQl.


-Atlast what every you learn you have to Implement it according to large or small scale projects requirement's.

Top comments (0)