Hello for everyone, today over lesson is about the Sql NoSql When & Way, I hope this lesson is useful for you.
NoSQL databases store information like you would recipes in a book. Whn you want to know how to make a cake, you go to that recipe, and all of the information about how to make that cake (ingredients, preparation, mixin, baking, finishing, etc.) are all on that one page.
- – MongoDB
- – DynamoDB
- – Couch DB
SQL is like shopping for the ingredients for the recipe. In order to get all of you ingredients into your cart, you have to go to many different aisles to get each ingredient. When you are done shopping, you grocery cart will be full of all the ingredients you had to run around and collect.
- – MYSQL
- – PostgreSQL
- – MariaDB
Lets Get Technical
In technical terms. NoSQL tell you to keep everything in one single recod. This single record is called document in NoSQL databases and look like below.
|Document 1||Document 2||Document 3|
SQL or Relational database asks you store each record seperately and store references (foreign keys) of needed records in single record. This single record is a row.
Yok can get the table form here–>> Source: https://www.instagram.com/logical_programming/
But Way These 2 ??
The major reason of existance of a NoSQL database requires a defined structure (schema) of data to store. Like in image below Entry 2 is empty but still taking up space in row.
|Entry 1||Value 1|
|Entry 3||Value 3|
|Entry 4||Value 4|
But Way These 2 ??
On the other hand, NoSQL database gives the freewill to store anything in a record (document). If value is not there, you don’t even need to put that in document. Which gives the flexibility to developer to use such type of database for unstructured ata stroage. Which makes it a great fit for BIG DATA analytics.
How Should I Choose ??
You should use NoSQL Database – for storing entity specific data where no relationship needed like maintaining user logs, time tracking, edit histrory, seo analytics etc.
QSL databases should be used for heirarchy structure. Where we need parent child relationship e.g, transactions, catalogues, inventory, billing related data.
In many use cases, you can’t define weather to use NoSQL database or SQL because in simple scenario both seems fit.
E.g. for calculating the exam results. In such cases, it’s just a matter of preference whom you are comfortable in.
Bonuc: Write operations in any NoSQL is much faster than any SQL database because it doesn’t validate for schema how ever quering is faster in SQL database because of structure. But you will observe these differences only when you are dealing with GB’s of data at once. Otherwise both seems identical