Are all databases relational?


#1

Question

In the context of this exercise, are all databases relational?

Answer

No, not all databases are relational databases. Databases can be non-relational, and this type of database is referred to as NoSQL databases.

NoSQL databases are structured differently from the relational database structure. With relational, we structure tables by the type of relations, but NoSQL keeps all the information in one place, in the form of key-values or documents.

For example, consider a database of people and their subscriptions to a newsletter.

Using a relational database structure, we might separate the information for each person, having their id, name, and email, in one table named customers, and then another table for the subscriptions, having the newsletter name, and other information associated with the subscriptions.

With a NoSQL database, instead of separating information in this way, we might just have a single document with the person’s information, as well as the subscription information, all in one document. As you might tell, this type of structuring might have some benefits and some cons compared to relational databases.