SQL vs NoSQL Difference

SQL vs NoSQL Difference

·

3 min read

What is Database?

A database is a systematic and organized collection of data. Data can be text, videos, files, audio and so on. It is used to arrange the data in a proper way so that sorting, searching and updating becomes easy.

When we build software, depending on the amount of data, we choose types of databases. For instance, if we have very small chunks of data to render and update frequently then google spreadsheet (excel) is enough otherwise we use SQL or no-SQL based databases like MySQL or MongoDB to structure our data that can handle the large volume of data. Both SQL and no-SQL have their pros and cons. Read below for a better understanding.

SQL

  • SQL is not a database.
  • SQL is the Programming language to interact with the database through “Query”(A query is a request for data or info from the database”). Simply it is the Query language to talk with database And it’s not Procedural like C nor Object Oriented language like C++.
  • SQL stands for “Structured Query Language”.
  • MySQL, Oracle, Postgress, MariaDB etc are the database that uses SQL.
  • SQL database like MySQL, Oracle is Primarily called as Relational Database(RDBMS) which means it follows the structure of data in rows & columns.
  • SQL use a Predefined Schema(layout) like Primary Key, Int, Float, Varchar etc.
  • SQL is actually a hybrid language. It consists 4 languages:

  • DQL(Data Query Language): Used to query the database for info, Get the info that is already stored there

  • DDL(Data Definition Language): Used for defining database Schema.
  • DCL(Data Control Language): User & Permission Management.
  • DML(Data Manipulation Language): Used for inserting, updating, deleting from the database.
  • In SQL data is distributed across Multiple tables then we connect to the relation using One-to-One, Many-to-One, Many-to_Many or using Joins.
  • In SQL, Horizontal scaling is impossible/difficult but vertical scaling is Possible. It is scaled by increasing the horsepower of hardware.
  • Read & write operations are limitations.
  • SQL databases are not the best fit for “Hierarchical data storage”.
  • SQL databases are table-based databases.
  • SQL databases are not useful for big data.
  • SQL databases like MYSQL are good for high transactional-based applications.
  • SQL databases emphasize on “ACID” (Atomicity, Consistency, Isolation, Durability) Properties

NoSQL

  • It stands for “Not Only SQL”
  • MongoDB, Couch, Redis, Neo4J are the example of databases that use No-SQL.
  • NoSQL databases are Primily called as Non-Relational or distributed databases.
  • NoSQL databases are “document-based”, “key-Value Pairs”, Graph DB or wide Column stores”.
  • Types of NoSQL databases: There are various types of NoSQL databases but mainly it’s categories on 4:

  • Document Database(MongoDB) is the most popular NoSQL database which uses JSON or XML format of data storing.

  • Key-Value Database(Redis)
  • Wide Column Database(Apache Cassandra)
  • Node/Graph(Neo4J): This type of database is being used on Facebook.
  • NoSQL database concept comes from various Top Tech companies like Amazon, Facebook, Google.
  • It is used for big data.
  • It has no predefined schema as SQL have.
  • NoSQL handles unstructured data but in SQL we have to learn database design.
  • It is cheaper to manage.
  • It uses Horizontal Scaling & even vertical scaling is Possible.
  • NoSQL databases are scaled by increasing the database server,
  • NoSQL database fit for “Hierarchical data storage”
  • For high transaction is not still comparable to SQL.
  • It follows the Brewers CAP theorem (Consistency, Availability, & Partition tolerance).
  • Great performance for reading & Write operation.