Database — Introduction (Part 1)
Why a database, What’s a database, and DBMS.
Before jumping into the databases, and the features they provide, we instead will start by why we would need a database, because they are designed to solve problems. “So, what are these problems?”…
Why Do We Need A Database?
When you have some data, and you want to store this data some where. This data could be anything. It could be about customers, products, employees, orders, …etc. This data could be in text format, numeric, dates, document files, images, audio, or video.
Maybe if you have data about the customers in your company, the first thing that comes in mind is to open a spreadsheet. Then you start write whatever the data you want to store.
It could be the customer name, id, position, and so on. You may add as many as customers, delete any of them later, or even modify on them. And that’s it!.
Now, we have kind of data, and you stored them in spreadsheets in a way that satisfy your need. That might be OK, because just having a data is not a good enough reason to need a database, and it’s not the problem. The problem is what comes next, and there’s a lot of potential problems.
What if you have a bunch of data, maybe 10,000 customer, “Are you going to scroll down in the spreadsheet to get the 9999 customer?!”, What if the security was a concern, “Do you care about if someone else got an access to your data?”, What if you accidentally put a redundant information, “Is it fine to have duplicate information along the spreadsheet?”.
This takes us to the next question, “When do we actually need a database?”. Consider the following potential problems:
You may have thousands or million of rows of customers, or any piece of information.
“Do you care if someone entered incorrect data?”. If yes, nothing could actually prevent me from typing incorrect data into a spreadsheet.
If the data is sensitive, and you need to restrict the access to the data; It doesn’t need to be shared with everyone. In addition, “Do you need to know who made every change at every point?”.
If the redundant data (having multiple copies of the same data) will lead to conflict, you would need to have only a non-repeated unique data.
“What if you had a disconnect or a crash, and you lost your data?”. You’ve probably felt that pain before. And it’s unacceptable to lose important data like orders of a customer, allergies of a patient, flight bookings, …etc.
How about having more than one person overwriting the same data at the same time. How about 10 at the same time or 100 people at the same time?. You’ll end up with everybody overwriting everybody else’s changes.
If you are saying “Yes” to one of these problems, or all of them and more besides, to keep the data reliable, secured, and maintainable. So, you need to have a database. That’s what we are going to discuss here.
What’s A Database?
It’s a structured system to put your data in that imposes rules upon that data, and the rules are yours, because the importance of these problems changes based on your needs. Maybe your problem is the size, while someone else has a smaller amount of data where the sensitivity is a high concern.
It’s the things you can’t see that are going on in the background; the security, the enforced integrity of the data, the ability to get to it fast and get to it reliably, the robustness; serving lots of people at the same time and even correctly survive crashes and hardware issues without corrupting the data.
And that’s what we need to do here; understand how to describe our structure and define those rules, so all these invisible things will actually happen.
Database Management System (DBMS)
We often mistakenly say our database is Oracle, MySQL, SQL Server, MongoDB. But, they aren’t databases, they are database management systems (DBMS).
The DBMS is the software that would be installed on your personal computer or on a server, then you would use it to manage one or more database.
The database has your actual data and the rules about that data, while the DBMS is the program that surrounds and manages your actual data, and it enforces the rules you specified on your data. The rules for example could be the type of the data, like integer or string, or the relationship between them.
In practice it’s very common to have multiple databases. The database that deals with your order and customer information might be completely independent from you database that deals with human resource information. And in many organizations, you don’t just have multiple databases but multiple DBMS. Sometimes it’s because one DBMS is better at something than the other.
There are different DBMS, and they are categorized under:
- Relational Database Management Systems
- Hierarchical Database Systems
- Network Database Systems
- Object-Oriented Database Systems
- NoSQL Database Systems
We are going to focus on the relational database management systems (RDBMS). And here’s Why? …
- They are the most common used one.
- The principles we are going to discuss here are usable across all of them.
- If you know you are going to jump into NoSQL databases, most of the introductions assumes you already understand relation database concepts and will use these concepts to explain what’s offered by NoSQL databases.
RDBMS are like Oracle, MySQL, SQL Server, SQLite, DB2, …etc.
Now you understand why would we need a database, what’s a database and the difference between database and DBMS. This will take us to the first step in understanding the database fundamentals in the next tutorial.