Database — Introduction (Part 1)

Why a database, What’s a database, and DBMS.

Omar Elgabry
OmarElgabry's Blog
5 min readSep 14, 2016

--

The ancient Egyptians used to write (store) their data on the wall

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 somewhere. 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 to mind is to open a spreadsheet. Then you start writing whatever 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 them. And that’s it!.

Probably this is what comes into your mind when you hear the term “database”.

Now, we have a kind of data, and you stored them in spreadsheets in a way that satisfies your need. That might be OK, because just having 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 customers, “Are you going to scroll down in the spreadsheet to get the 9999 customers?!”, What if the security was a concern, “Do you care about if someone else got access to your data?”, What if you accidentally put redundant information, “Is it fine to have duplicate information along with the spreadsheet?”.

This takes us to the next question, “When do we actually need a database?”. Consider the following potential problems:

Size

You may have thousands or millions of rows of customers, or any piece of information.

Accuracy

“Do you care if someone entered incorrect data?”. If yes, nothing could actually prevent me from typing incorrect data into a spreadsheet.

Security

If the data is sensitive, and you need to restrict 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?”.

Redundancy

If the redundant data (having multiple copies of the same data) will lead to conflict, you would need to have only non-repeated unique data.

Importance

“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.

Overwriting

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?

Probably this is what comes into your mind when you hear the term “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 is 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 databases.

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.

Database Management System (DBMS)

In practice, it’s very common to have multiple databases. The database that deals with your order and customer information might be completely independent of your 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 relational database management systems (RDBMS). And here’s Why? …

  • They are the most commonly used ones.
  • 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 assume you already understand relational 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.

Wrapping Up

Now you understand why would we need a database, what’s a database and the difference between a database and DBMS. This will take us to the first step in understanding the database fundamentals in the next tutorial.

References:

--

--

Omar Elgabry
OmarElgabry's Blog

Software Engineer. Going to the moon 🌑. When I die, turn my blog into a story. @https://www.linkedin.com/in/omarelgabry