You have probably heard the term database used many different times, even if you aren't technical. But what exactly is a database and how does it work? In this short article, we are going to go over database fundamentals as well as the different types of databases out there (flat file vs relational vs non-relational).
Database Fundamentals
The definition of a database is a structured set of data held in a computer that can be accessed in various ways. Simply put, a database is a place that can store a variety of data. That data can be anything such as usernames, passwords, photos, videos, etc. There are local databases, which are databases within your laptop, tablet, or phone. There are also remote databases, which are hosted offsite and online within cloud servers. The data within these databases can be accessed via the internet. Almost every single app in the world uses remote databases to store their data.
Flat File Database
Now that you've got a good grasp of what a database is let's jump into the first type of database: the flat file database. Flat file databases store data in plain files such as .xlsx or .csv. Data within a flat file database are organized through commas and tabs. Flat file databases are great for storing simple data such as a monthly budget or a list of names. Tools commonly used as flat file databases include Microsoft Excel, Google Sheets, and Airtable. In order to store more complex forms of data, a database management system is needed. This is where the relational and non-relational databases come into play.
Relational Database (SQL)
SQL stands for structured query language, and is the most popular relational database currently in use. SQL and other relational databases make it possible to easily manage and query for data. Relational databases are so named because they store data in the form of tables, columns, and rows.
Think of a dresser with many pullout drawers. Within each drawer we can store a different type of item. After we store an item within a drawer, we label that drawer with the item's name or category, like socks or underwear. Next time when we look for that item, we can easily find it by simply searching for the type of the item on the dresser labels.
Here's a real life example. Let's say we are a business that wants to organize our customers' billing information and survey responses. Using a relational database, we can relate all customer information back to each customer. If we know the customer's name or email, we can run a single, simple command to pull down all data related to that customer. This would not be as easily accomplished with a non-relational database. Popular examples of relational databases include SQL, Oracle, MySQL, PostgreSQL, and MariaDB.
Non-Relational Database (NoSQL)
In contrast to a relational database, a non-relational database is one that is less structured in format. So instead of a dresser, now think of a Word document. This allows the data to have more flexibility and adaptability. Each line in the database could be an image, text, or chart.
If you are going to be dealing with data that isn’t clearly defined (e.g. a message thread), you likely won’t want to establish defined tables and relationships within that dataset. Examples of popular non-relational databases include MongoDB, ScyllaDB, Amazon Dynamo DB, Firestore, and Couchbase.
Final Thoughts
So there you have it! In short, databases are places where you can store all kinds of data. The types of data stored will call for different type of databases. If you are curious to learn more databases, you can check out our blog on the pros and cons of SQL vs NoSQL databases. If you have any questions regarding software development in general, feel free to reach us at resources@aloa.co!