What came before?
Before the advent of many databases, so-called flat databases were used. They not only had limited functionality, but were essentially just plain text files. All information had to be presented as text, and the size of this "database" was significantly limited.
In addition, to separate fields, a delimiter had to be specified every time. Programmers often used a comma or a semicolon for this purpose.
However, another problem arose with this, as the relationships between fields were absent, making searching for information a very difficult process. A visual example of flat databases is Comma Separated Values (CSV) files.
In 1960, hierarchical databases appeared, introduced by IBM. The principle of data formation was a tree-like structuring organized as parent-child relationships. At the same time, an object could only have one parent, but one parent could have many "children". Hierarchical databases are considered the prototype of relational databases.
As we mentioned at the beginning, the most necessary ones today are relational databases. The first person to propose their use was an IBM employee and American mathematician, Edgar F. Codd, in 1970. This event became an innovative breakthrough in the history of databases.
Prominent examples of relational databases include SQL Server, MySQL, and PostgreSQL. However, to interact with them, knowledge of the structured query language (SQL) is required. Don't be discouraged, as it has many advantages, including a system of standards and a convenient process for data migration.
The main way of storing data in relational databases is a table consisting of columns and rows. Information is recorded in the rows, and columns can be assigned a specific type. Everything added to the table can be linked to each other using foreign and primary keys.
Document-oriented databases or document stores are used as a repository for collections of documents. The most commonly used formats for these databases are BSON, XML, or JSON. In these databases, each document has its own structure, and a collection can contain multiple documents with different structures. Information can be stored in various data types.
Document-oriented databases are the most popular among non-relational databases. For example, MongoDB, created in 2008, has been downloaded over 400,000,000 times and is currently used by Bosch and Barclays.
Key-value databases are based on the principle of storing data in pairs of keys and values. It can be compared to a dictionary - to determine the value, it is enough to find the key. This type is invaluable for cases where the data stream is small, but speed is crucial. It can be used to store settings and even embedded in applications. Because of its simplicity, key-value is worth considering for developers. Redis is one of the most popular representatives of this type of database.
A graph database is built with nodes and graphs (edges). There are two types of data that can be used in these databases. Nodes contain data, and edges indicate their interaction.
Despite their similarity to network databases, graph databases have many more abstractions. Examples include Dgraph and Neo4J.
Columnar storage databases, or families, are another type of non-relational database. They are distinguished by their high level of productivity, excellent scalability, increased speed, and efficient data compression.
At the heart of this storage is something very similar to a table. But here, column families are used, and key spaces are used to store and search for them.
It is well-known that information has been called the new oil. Therefore, the number of types of databases and their representatives will continue to grow. And no matter how cool and in-demand relational databases may be, the world will need more functional options with a large set of tools.