Today i will teach you about the difference between Relational and Non-relational Databases
SQL Databases (Relational)
SQL is short for Structured Query Language, basically meaning a very firm way of sorting through data in the form of tables, columns, and rows. How is data structured in an SQL database? The table itself would be made up really of one variable or object that we would be looking through. The column would represent the data point itself that needs to be stored and the row is a record of the data points per column.
For example, if you are looking to sort data regarding what the weather is at a certain time of the day during a certain day, it would be structured as the following:
- Table: Weather
- Columns: Days of the Week
- Rows: Time of Day
- Data Points: Degrees Fahrenheit
In this structure, all queries would be related to this table and the structure of the table would allow for easy sorting, filtering, computations, etc. If we ever need to establish a connection between tables, say, you want to know what the weather was at a certain time and relate that to a baseball game’s predicted score, then what we do is create what is called a key. This key allows for connections to be made between two or more tables to solidify associations between the two.
Some popular SQL database systems include:
- Oracle
- Microsoft SQL Server
- PostgreSQL
- MySQL
- MariaDB
NoSQL Databases (Non-Relational)
In contrast to a relational database, a NoSQL database is one that is less structured/confined in format, and thus, allows for more flexibility and adaptability. If you are going to be dealing with a dataset that isn’t clearly defined, meaning not organized or structured, you likely won’t have the luxury of establishing defined tables and relationships amongst the dataset.
For example, Facebook Messenger uses a NoSQL database, because the information that is being gathered isn’t structured enough to be segmented into tables and define relationships between each other. With tons of unstructured information, it needs to be held in a non-relational database. Think of the information as being stored on one large word document. Everything is there. As more information gets entered, the document gets longer. If you want to find and pull data, you have to in essence ‘control/command + F’ and search for the data itself.
Some popular NoSQL databases include:
- MongoDB
- Cassandra
- Redis
- Apache HBase
- Amazon DynamoDB