28/12/2022
The 2 most popular ways to store data in any modern application are:
1) SQL
2) NoSQL
Here's what they mean in the simplest terms:
1. SQL
- Used to store relational data, where one set of data is related to another
- It is strictly structured in nature, so before using it we need to specify what exact structure we need to use
2. NoSQL
- Used to store unstructured data, where each set is not expected to be related to each other
- It's not strict in nature and its schema can be changed at runtime as well
3. How are they Stored?
- SQL, is only stored in tabular format so we need only SQL queries to interact with it
- NoSQL, comes in many varieties i.e. Key-value store, JSON based, document-based, etc hence based on the NoSQL vendor your way of interaction will change
4. How're they Queried?
- SQL is queried using SQL statements, which are used to specify the data that should be retrieved and the conditions it must meet
- NoSQL often provide more flexible query capabilities, allowing users to search for data based on various criteria
5. How're they Scaled?
- SQL DB are typically scaled by adding more hardware resources, such as additional servers or storage
- NoSQL DB, are designed to be distributed across multiple servers and can be scaled horizontally by adding more servers to the cluster
6. When to use SQL?
- You need highly structured data, a strict schema structure, with strict validation rules
- Your Data set is highly mapped with each other and in order to fetch you need to use complex queries
- Frequent modification of data is required
7. When to use NoSQL?
- Need to store and process large amounts of unstructured or semi-structured data
- Need to achieve high availability and low latency
8. Realworld Examples:
SQL
- Inventory Management System
- Library Management System (For well-structured data)
NoSQL
- Realtime analytics system (Managing unstructured data from IoT devices)
- Gaming applications (For high availability and low laten