A database can be identified as:

"A structured set of data held in a computer, especially one that is accessible in various ways."

What does that mean though?  Well, imagine a big plate of spaghetti.  Not a small plate, but a plate made up of the entire shelf of pasta at the local grocery store.  Now, imagine wanting to get out a specific piece of spaghetti of a specific length, style, and brand from that plate.  There’s no way to do it.  There’s too much “data” all jumbled up with no organization.  There must be a better way!

There is.  You can store your spaghetti in an easily searchable, well structured database.

Every piece of spaghetti has various properties.  Off the top of my head, there’s brand, length, thickness, degree of doneness, semolina or whole grain, and the time it was cooked.  This is all data that we want to be able to organize our data in.  We could write it all out in text files (also known as “Flat Files”), and that would store the data, but that doesn’t index it in any way, shape, or form, and finding your data would be a nightmare.  The answer is to make a “table” in your database.  Visually, a table looks like a spreadsheet, but behind the scenes, magic happens and you can find any piece of data held within it.

This is the structure of our “spaghetti” table with a bit of data added:spaghetti_data

We didn’t discuss it, but I added an “id” field so that each line of data has a unique identifier to add the benefit of easily referencing each row.  This is important.  It’s like the barcode at the grocery store that tells the cash register what item is being rung up.

Now that our data is in a nicely organized table, we can easily hunt for the data that interests us.  For instance, lets say that we want to get all of the undercooked spaghetti.  We can say that any rows with a doneness less than 80%.

Or, we can get all of the strings of spaghetti that is not whole grain.

Finding data in a database is super fast and super easy when it is well organized.  This can be applied to something such as a User table for your website, where you look for the data with the matching username and password.  If the database doesn’t give any rows, you know that there is no match for the username and password.

If we had our data in flat files, we would have to go line by line by line to see if the data matches what we are looking for.  That is tedious, slow, and inefficient.  That’s why we use modern database technology.  We can zero in on the data fast and efficiently and give the users the best experience possible.

Share This: