SQLvs No SQL
SQLvs No SQL
data. On one hand, this is extremely powerful: SQL is one of the most versatile and
widely-used options available, making it a safe choice and especially great for
complex queries. On the other hand, it can be restrictive. SQL requires that you
use predefined schemas to determine the structure of your data before you work with
it. In addition, all of your data must follow the same structure. This can require
significant up-front preparation, and, as with Town A, it can mean that a change in
the structure would be both difficult and disruptive to your whole system.
A NoSQL database, on the other hand, has dynamic schema for unstructured data, and
data is stored in many ways: it can be column-oriented, document-oriented, graph-
based or organized as a KeyValue store. This flexibility means that:
You can create documents without having to first define their structure
Each document can have its own unique structure
The syntax can vary from database to database, and
You can add fields as you go.
The Scalability
In most situations, SQL databases are vertically scalable, which means that you can
increase the load on a single server by increasing things like CPU, RAM or SSD.
NoSQL databases, on the other hand, are horizontally scalable. This means that you
handle more traffic by sharding, or adding more servers in your NoSQL database.
It’s like adding more floors to the same building versus adding more buildings to
the neighborhood. The latter can ultimately become larger and more powerful, making
NoSQL databases the preferred choice for large or ever-changing data sets.
The Structure
SQL databases are table-based, while NoSQL databases are either document-based,
key-value pairs, graph databases or wide-column stores. This makes relational SQL
databases a better option for applications that require multi-row transactions -
such as an accounting system - or for legacy systems that were built for a
relational structure.
Some examples of SQL databases include MySQL, Oracle, PostgreSQL, and Microsoft SQL
Server. NoSQL database examples include MongoDB, BigTable, Redis, RavenDB
Cassandra, HBase, Neo4j and CouchDB.