SQL vs NOSQL
By: Pasindu Hewagamage
Tags: NoSQL, Sql

Relational Data Base Management Systems (RDBMS) like SQL is the best option to primary model database management in today and past few decades as well. But non relational database management systems which are known as NoSQL gaining a big attention in the IT industry. Therefore lets see the evolution of both SQL and NoSQL first.

SQL

SQL stands for “Structured Query Language”. This language is used to storing , manipulating , retrieving data which are stored in relational databases. Every RDBMS like MySQL, Sybase, MS Access, Oracle use SQL as their standard language.

SQL uses query language to communicate with databases.

SELECT id ,name FROM Student

Above is a simple query to retrieve data from the “Student” table. “SELECT”,”FROM” which are in bold are some of the SQL syntax/keywords. Rest of the words data/parameters.

Above is called as a relation/table in Structured Query Language which is used to store data. Usually table consist of rows and columns. ”ID” and “Name” are the columns which are the data fields of this table. “S0001 , Kavindu Perera”, “S0002, Ravindu Dissanayake” are rows which are also known as tuples/records in relation.

Normally SQL follows schema. Simply it means logical structures to store data. In other words schema is a separate container or namespaces to store database objects. This facilitates user to manage several logical independent entities with in the single physical database.

SQL is one of the greatest technologies which follows up ACID properties. So lets see what the ACID properties are.

ACID properties

This is is the acronym of the Atomicity, Consistency, Isolation and Durability. Experts say that these principles are capable of guarantee the reliability of the database management systems.

Atomicity — This ensures whether a particular transaction is succeed or not. If there is partial error then the whole transaction can rejected.

Consistency — This guarantees that all the data are consistent. It ensures existence of the data with in the database according to its specific rules and regulations.

Isolation — This means transactions which are occurred are not dependent each other.

Durability — Every transaction should be stored in the database permanently. Whether it is an insertion or modification or deletion or any other activity should be recorded properly . even if there is a system crash , that can not be affect to the recorded data.

NoSQL

On the other hand other technique of data management of data NoSQL. We can classify some of the NoSQL DBMS according to the data storing mechanism.

Store data as “Key : Value” pair. eg:-Redis,Riak

Stores data as documents (JSON,XML) in maps or collection. eg:-MongoDB

Stores data as column families as rows. This known as Column Family mechanism. eg:-Cassandra

Stores entities and relationships together and display them in a graph. eg:-Neo4

NoSQL is capable of store different types of data and we can easily spread out this database all over the server system. This non relation DBMS makes the developer to implement very quickly and it has a good performance. Nowadays Most of the organizations which are assisted cloud computing technologies, large scaled monolithic architectural designs and microservice based architectural systems are trying to refactor their database infrastructure with NoSQL technologies .But However NoSQL are not following up the ACID principles properly.

Difference between NoSQL and SQL

Now lets compare and contrast SQL and NoSQL technologies. Most commonly known difference is SQL is associated with relational database technology, while NoSQL is associated with non-relational database technology. SQL consist of fixed/static schema , But NoSQL has no any predefined schema. It could be dynamic. If we focus on the scalability, NoSQL is horizontally scalable and SQL is vertically scalable. Because of this scalability SQL is definitely not suitable for horizontal data storage , but on the other hand NoSQL is the best technology which would be applicable for horizontal storage. SQL follows up “ACID” fundamental principles, therefore it is more suited for more complex systems. NoSQL is suited for simpler systems because it is not practicing “ACID” rules properly.

Conclusion

As a two side of a coin every technology consist of both advantages and disadvantages . Therefore we can’t state a specific technology is better than the other. It depends on the context and working environment. Therefore we should be able to NoSQL or SQL or any other technology with regard to nature of the requirements , complexity , way of deploying and so on. Then we can define the best database technology for a particular software development project.