When it comes to database and DBMS (Data Base Management System), one question should come to mind : Should I use SQL (Structured Query Language) or NoSQL (Not Only SQL or No SQL) databases.
Well, it depends on every projects. Both systems will store your datas but each of them has its way. The primary difference is that SQL databases are relational while NoSQL databases are non-relational. Then, NoSQL databases have dynamic schema for unstructured data while SQL databases use structured query language and have a predefined schema.
1/ SQL Databases
SQL organize the data storage following the principle of linked tables. Theses databases have a defined structural schema. The schema includes tables and each table include a defined number of columns. The user won’t be able to update the table beyond the number of columns, so this will keep the integrity of the datas and ensure the type of datas that are saved in the database.
This strict model will make mistakes less and less present.
The data schema will have to be designed before doing any business logic to manipulate datas. All of the datas have to follow the same structure. This require considerable preparation, so any change in the structure would be difficult and disruptive.
Examples of SQL Databases : MySQL, Oracle Database, PostgreSQL …
2/ NoSQL Databases
NoSQL Databases are designed to be more flexible and contain bigger quantity of datas.
Theses databases don’t have predefined schema or tables. They are more like dynamic schemas for unstructured datas. Datas can be stored in four ways : column-oriented, document-oriented, graph-based or organized as key-value.
The flexibility means that you don’t have to define the structure of your documents to create them, you can add fields wherever and whenever you want, and each document can have its own unique structure.
Both the representation of datas as collections and the request result as JSON allow to get the datas faster and easier by the front-end applications.
Examples of SQL Databases : MongoDB, Apache Cassandra, Google Cloud BigTable …
The choice between SQL and NoSQL database will depends on the project requirements. NoSQL databases being horizantally scalable, datas can be split in multiple databases to reduce the load. So it is possible to handle more traffic by splitting or adding more servers in the NoSQL database. Because of this, NoSQL databases are « Big Data » oriented. On the other hand, SQL databases are vertically scalable, meaning that datas can’t be split. To increase the load, you will need to increase the CPU, RAM or Memory of the database server.
In the end, there is no « winner », just a better one according to each project.