If you have never worked with a database before, you may be asking yourself, “What is all this database talk about?” It’s a good question and the simple answer is one that you already know. It’s a place to store data.
Well, that answer is correct but, it’s a pretty bad answer; let’s go into a little more detail.
Why do we need a database?
Let’s talk a little bit about data, it’s everywhere. As computers are more and more integrated into our lives, we are generating data at an increasing speed. This wealth of data has created quite a number of questions and issues for us including:
- Where should all of this data be stored?
- What kinds of data do I have?
- How do I find the data I am looking for?
- Who should have access to the data?
A place to store data
Applications run on data. Chances are that you have hundreds of gigabytes of data stored between your phone, computer and the cloud. Often, this data is stored in files. I have lots of files, thousands of them. Here are some examples:
- Photos from my vacation earlier this summer
- A copy of my resume
- A programming project that I started working on and have since abandoned
- A list of bills that I need to pay
These are “organized” on my computer in a way that I would probably have some difficulty explaining. I’ll save you the headache of that explanation. The point is that I have lots of different data in files those files have different types and uses.
Folders allow me to setup this sort of organization for these files. I might make a folder called “2019 Vacation” for my vacation photos and other folders such as “Lists” to hold all of the lists that I have for various things.
An organization system for data
A basic file system allows us to organize the files on our computers. Databases, specifically relational databases which are the type of databases that we will be discussing, allow us to organize data in a way that makes sense.
Let’s say that we want to keep the information related to a food truck organized and easy to use. We might create a food truck database that holds information such as:
- The items on the menu
- The prices for the menu items
- The recipes
- The ingredients
- Sales records
- Locations where the truck sold food
A database will allow us to create a structure to store this information in addition to the data itself. This data won’t be stored in files, it will be stored in tables. Tables are structures that have columns and records (rows). Each record in a table will contain a place to store a value of each column.
A database will contain as many tables as it needs to store all of the related information. In this way, databases can contain tons of information structured in a defined way.
We will go further in depth on how this structure works in future posts. For now, we just need to know that this structure exists and is handy because it allows us to know exactly where we have placed the information.
A way to find data
Databases shine when it comes to allowing you to query the information that is contained in them. It’s one of the main things that they are designed to do. Most databases will use Structured Query Language (SQL) to allow you to retrieve the information stored in them.
SQL is standardized and once you learn it you can use it to interact with all kinds of databases. You may have to learn a few idiosyncrasies of each, but most of what you know will work on any database. This is why SQL is incredibly useful to learn and one of the things that we will focus on in future posts here on the Coding Truck.
Additionally, SQL allows you to view the structured data in nearly any way that you can imagine. All you have to do is describe how you would like the data to be formatted and it will go fetch it for you. That is, if you have permission to see it.
In the past few years there has been a lot of focus on privacy and data security. With all of the data that is stored out there, the questions of how to keep the data private and who had the true ownership of the data are more important than ever. A database will not tell you who should have access to data, you will have to decide that for yourself.
A good database management system (DBMS) will allow you to setup authentication and security so that you can specify which users are allowed to create, view. modify or delete information.
This is very important, because it will protect the data and keep it safe even from yourself.
So what is a database again?
A database is a tool that we use to store data, safely and in an organized manner so that we can find the data again at a later time. Often, a databases will be tied to a particular application to store and later display information quickly and efficiently.
Did I do a good job of explaining what a database is? Do you have any further questions? Please leave your feedback below.