SQL VS NoSQL !

Jihan Binte Jashim

--

By looking at the title, it may seem like a conflicting or controversial article. But no! it's just a comparable article about the two most famous databases.

Nowadays an important part of human life is the database. Whether you know it or not it has an impact everywhere. From social media to personal virtual storage or government data. The database is everywhere!

When choosing a database, one of the critical situations is picking the type of database. Should we choose the relational database (SQL) or non-relational (NoSQL) data structure? Both are very good options from the types of aspects but have some key differences between them. These differences can make a comparable discussion on them. Let's dig in the hole.

In the previous paragraph, I told about the key differences between SQL and NoSQL. Now let me tell you in detail.

Definition

SQL means Structured Query Language. SQL is a programming language that is used to manage data in a relational database. These databases require knowledge of SQL language to manage them. They build with a collection of tables. For example — MySQL, Oracle, MSSQL, PostgreSQL, etc.

NoSql stands for Not Only SQL. It refers to non-relational databases. They are database that stores data in non-relational or a format other than a relational table. Some NoSQL databases are MongoDB, CouchDB, CouchBase, Amazon SimpleDB, etc.

Properties

Properties of SQL databases are:

  • Atomicity — All transactions must either totally succeed or fail. Meaning all changes made by the transaction are completed as a single unit, or none of the changes are made. If a partial transaction were committed, the atomic property is violated, and the database is left in an inconsistent state.
  • Consistency — Consistency refers to a set of values that all data points within the database system must align to in order to be properly read and accepted. Should any data that does not meet the preconditioned values enter the database, it will result in consistency errors for the dataset.
  • Isolation — Isolation is the separation of resource or data modifications made by different transactions. Isolation levels are described for which concurrency side effects are allowed. Even if they are executed in parallel, transactions must provide the same end state as if they were executed sequentially.
  • Durability — In database systems, durability is the ACID property that guarantees that transactions that have been committed will survive permanently.

NoSQL systems follow the “CAP” theory, which is:

  • Consistency — Every request receives either an error or the most current result. (Note that this differs from ACID.)
  • Availability — Regardless of how recent the result is, every request receives a non-error response.
  • Partition tolerance — The system will continue to function even if there are delays or losses between nodes.

Database Architecture

Database architecture is a representation of DBMS design.

SQL databases are relational database means there will be one or more tables that will contain data, and the data will have a relation between them.

As we know NoSQL databases are non-relational databases. This means there will be a logical way of categorizing data. It presents a horizontal scaling of the database. Data can be Key-Value pairs or column-oriented or graph-based or document-oriented etc.

Database Schema and Language

SQL can be quite limiting. Though it has a pre-defined schema for creating and managing data and using query structured language. But before working with it we have to define the data structure and all the data must have the same structure. And this process is quite advance preparation and work and It can bring a difficulty to the system. Still, it is one of the most widely used systems.

NoSQL has a very flexible schema. NoSQL databases are for unstructured data. And here data can be stored in many ways. Some example is — Key-Value pair, column-oriented, graph-based, document-oriented, etc. The advantages of NoSQL databases are we can create documents without defining their data structure, each document can have a unique structure, and syntax can vary from database to database.

Query Patterns

How data goes fetched can bring differences between them. Where SQL allows searching for data by pattern matching. The data in SQL databases are usually normalized, data must be connected from many tables to perform a query on a single object or entity. As the size of tables increases, the joins may get more costly.

Queries in NoSQL are faster than in SQL. NoSQL databases often store data in a manner that is query-optimized. When using NoSQL, it is generally accepted that data that is accessed together should be kept together. Typically, joins are not used in queries, making them extremely quick.

Scalability

Most SQL databases are vertically scaled by increasing the processing power of existing hardware.

NoSQL databases are horizontally scaled with additional servers and nodes.

Conclusion

In this article, I have discussed some key differences between SQL and NoSQL. Which compares these most used databases. Hope this article helps you to get some idea about these two databases.

Thank you so much for reading this far.

I hope you liked this quick guide, don’t hesitate to 👏 the article if you found it interesting!

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Jihan Binte Jashim
Jihan Binte Jashim

No responses yet

Write a response