NO SQL


**Before Cloud Computing:**

- **Hierarchical Model**: Used for strictly parent-child (hierarchical) relationships.

- **Network Model**: Handles many-to-many relationships.

- **Relational Model**: Most common, proposed by E.F. Codd. Uses tables for data storage.


**Relational Databases:**

- **SQL (Structured Query Language)**: Language used to manage data in relational databases.

  - It has three components: 

    1. **Data Definition Language (DDL)**: Defines the structure of the data.

    2. **Data Manipulation Language (DML)**: Lets you interact with the data (insert, update, delete).

    3. **Data Control Language (DCL)**: Manages access to the data (permissions).

- **Popular Relational Databases**: Oracle, MySQL, SQLServer, Postgres.


**Shift to Cloud Computing:**

- With cloud computing came the need to store **unstructured or semi-structured data**, leading to the development of NoSQL databases.

- **NoSQL**: Misleading name; it’s not just about being “non-SQL,” but a different way to store data.


**NoSQL vs Relational Databases**:  

- **New terms**: 

  - Partition → Shard

  - Table → Document root element

  - Row → Aggregate/Record

  - Column → Attribute/Field/Property

- NoSQL has no stand-alone query language like SQL.


**NoSQL Database Models**:

1. **Key-Value**: Simple index (key) and associated value (like a dictionary).

2. **Document**: Structured/semi-structured data in the value part (more complex than key-value).

3. **Column-Family**: Large tables with many rows but only a few columns.

4. **Graph**: Nodes represent entities; edges represent relationships between entities.


**Characteristics of NoSQL Databases**:

- Designed for large-scale data (cloud storage).

- Support **partitioning** (splitting data across servers) and **replication** (copying data for safety).

- No single point of failure.

- Support consensus-based decisions.


**Soft-State and BASE**:

- **NoSQL allows data inconsistency** (eventually consistent), unlike relational databases that enforce consistency immediately.

- Traditional databases follow **ACID** properties (Atomicity, Consistency, Isolation, Durability).

- NoSQL databases follow **BASE** properties (Basically Available, Soft State, Eventually Consistent).

- **ACID vs BASE**: ACID prioritizes strict data consistency; BASE prioritizes availability and flexibility.


These simplified points should help with clearer understanding.

Comments