Hello for everyone, today over lesson is about the Sql NoSql When & Way, I hope this lesson is useful for you.

NO SQL

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.

  • Eg.
    • – MongoDB
    • – DynamoDB
    • – Couch DB

SQL

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.

  • Eg
    • – 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 1Document 2Document 3
{
“id”:”1″,
“name”:”John Smith”,
“isActive”:true,
“dob”:”1964-30-08″
}
{
“id”:”2″,
“fullName”:”Sarah Jones”,
“isActive”:false,
“dob”:”2002-02-18″
}
{
“id”:”3″,
“fullName”:
{
“first”:”Adam”,
“last”:”Stark”
},
“isActive”:true,
“dob”:”2015-04-19″
}

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.

XYZ VALUES
Entry 1 Value 1
Entry 2
Entry 3Value 3
Entry 4Value 4
Entry 5

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.

Usage

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

Source: https://www.instagram.com/logical_programming/