NoSQL Database

NoSQL Database

In any system databases perform a crucial role, right now we distinguish databases on basis of SQL and NoSQL.

  1. SQL Databases -

SQL or Relational Databases are structured and have a predefined schema. Like database table of users will have information columns like ID, Name, Address, Phone number, etc. All the records in this table will follow this fixed schema. In a relational database, data is stored in the form of rows and columns. SQL Databases - MySQL, Oracle, MS SQL, Postgress & Maria DB.

  1. NoSQL Databases-

NoSQL databases are non-relational and do not have a specific schema like SQL. Here we schema is dynamic so we can add extra if needed. NoSQL Databases - MongoDB, Voldemort, Dynamo, CouchDB etc. Let's see types of NoSQL database :-

Key-Value Store :-

Here data is stored in key value form. Common use case of this type of database is -

  1. When we want to store image (key will be image name and value will be it's path)
  2. Lookup tables,
  3. For query caching purpose. Well-known key value store DB are Redis, Voldemort, Dynamo.

Document Database:-

In this type of DB data is in the form of document instead of tables, and these documents are grouped together to form collection. The basic use of this type of database is to store tree structured information in single unit. As data is stored in document format the common usecase of this type database is when we want to perform "Heavy Read/Heavy Read + Heavy Write" operations. CouchDB and MongoDB are the examples of the document databases.

Wide-column Databases:-

Wide-column databases are somewhat similar to SQL database except one difference i.e in SQL DB we have predefined schema and even if we don't have value for any column then we have to pass null value for that column but in wide-column DB it is not needed to have fixed number of columns. Most ideal use case of this type of DB is when we want to perform Heavy Write operations. Cassandra and HBase are the examples of the column databases.

Graph Databases:-

Graph DB is used when data and it's relations are best represented in a graph. A graph database stores nodes and relationships instead of table and document. Most common use case of graph database is in Facebook (Facebook graph API). neo4j and InfiniteGraph are the examples of the column databases.

  1. High Level Differences between SQL and NoSQL Database :-

image.png