The two main types of modern databases to choose from are relational and non-relational, also known as SQL or NoSQL (for their query languages). There are a few main differences to be familiar with when deciding which database works best for your needs.tldr summary:
SQL databases are known as relational databases, and have a table-based data structure, with a strict, predefined schema required. NoSQL databases, or non-relational databases, can be document based, graph databases, key-value pairs, or wide-column stores. NoSQL databases don’t require any predefined schema, allowing you to work more freely with “unstructured data.” Relational databases are vertically scalable, but usually more expensive, whereas the horizontal scaling nature of NoSQL databases is more cost-efficient.
Relational databases (RDBMS) have been around for over 40 years. Historically, they’ve worked well, for the times when data structures were much more simple and static. However, as technology and big data applications advanced, the traditional SQL-based relational database was less equipped to handle rapidly expanding data volumes and the growing complexities of data structures. In the last decade, the non-relational, NoSQL databases became more popular for offering a more flexible, scalable, cost-efficient, alternative to the traditional SQL-based relational databases.
NoSQL databases feature dynamic schema, and allow you to use what’s known as “unstructured data.” This means you can build your application without having to first define the schema. In a relational database, you are required to define your schema before adding data to the database. Not needing a predefined schema makes NoSQL databases much easier to update as data and requirements change. Changing the schema structure in a relational database can be extremely expensive, time-consuming, and often involve downtime or service interruptions.
Relational databases are table-based. NoSQL databases can be document based, graph databases, key-value pairs, or wide-column stores. Relational databases were built during a time that data was mostly structured and clearly defined by their relationships. Today, we know that data today is much more complex. NoSQL databases are designed to handle the more complex, unstructured data, (such as texts, social media posts, photos, videos, email) which increasingly make up much of the data that exists today.
Relational databases are vertically scalable but typically expensive. Since they require a single server to host the entire database, in order to scale, you need to buy a bigger, more expensive server. Scaling a NoSQL database is much cheaper, compared to a relational database, because you can add capacity by scaling horizontally over cheap, commodity servers.
NoSQL databases tend to be more a part of the open-source community. Relational databases are typically closed source with licensing fees baked into the use of their software.