When you create a software program you typically display information. That information is stored somewhere. That somewhere is usually in a database. If you are asking what is a database then let me explain.
It is the one topic that is often overlooked when teaching anyone to learn how to code but is at the heart of so many video games, smartphone apps, websites, and software programs.
Not sure what CODING is, read my blog post, A CLEAR AND EASY EXPLAINATION on what is coding.
Since I am a huge Star Wars fan, I thought it would be fun to explain databases using examples with Star Wars data.
If you are seeking a fun way to get started using a database, I will be providing a free download at the GetMeCoding.com Courses.
In the meantime, hop in your speeder and let me be your guide to databases in this first of a series.
What do you do with a database?
Databases are ALL around us and you probably don’t realize you are using one right now as you read this blog post. As our digital world expands we will see the use of databases expand. I won’t go into the ‘dark side’ of databases in this post (security challenges). Let’s focus our minds on the ‘light side’ (providing information).
Let's look at an average person's day:
You wake up and check your social media or news on your tablet, smartphone, or pc. Social media and news websites store all your information in databases.
You get your day going and travel to work in your car. If you drive a new car, it is most likely using a small computing device that is storing your car’s performance for assisting in maintaining it when you go to a car mechanic.
You realize you need gas so you pull over at local gas station where you swipe your bank debit card or credit card. As you swipe you are sending information stored on your card to the gas station that hands you off to your bank or credit card company that then checks for money in your account. Your account is stored in their database.
Once you arrive at work, you sit at your desk where you login with your username and password. These are stored in your company’s database that recognizes you as an employee. That same database may also be connected (or integrated as us propellor heads say) to another database that contains your job description, pay information, and any benefits the company provides.
I thought you said this was about STAR WARS data!
Ok….let’s get to it.
In the database download below I provide you a free Star Wars Universe database for learning how to work with a database.
What can you do with Star Wars data?
If you want to view which space vehicles are in a movie with the planet Dagobah, then it is stored in the database.
If you are curious to know who made the X-Wing Figters in the Return of the Jedi, you can see who in the Star Wars universe made these attack fighters.
What if you wanted to look up what species Yoda belongs. You can check in the database but that one is interesting especially if you are a Star Wars fan.
Databases help you make sense of data. You can then take that data and display it in a report, a website, an app, or a desktop computer program.
What is a database?
A technical definition would be that it is a shared structure that has data that is related.
Here it is in a nutshell:
- The organized container that holds the data is known as a ‘relational database’.
- Inside the database are tables.
- Tables are created with rows and columns to store your data.
- Each row in that table stores data that helps describe the table it belongs.
Notice I didn’t call data, information.
What is the difference between data and information?
Many say it is the same thing but if you are learning to become a software coder you have to note they are different.
Data are the raw facts.
Information is what we get when we use the data.
When we use the data we are processing it or understand its meaning.
EXAMPLE with the Millenium Falcon:
If I were to say 100 miles per hour, you might recognize this as a measurement of speed or recorded raw data.
If Han Solo were to say 12 parsecs (parsec is a distance) you might recognize that as a distance the Millenium Falcon made the Kessel run in less than 12 parsecs.
For this discussion on database, what is the meaning of 12 parsecs? Is it fast or slow? Is it short or long?
Well….if this is a database table used to record the distance spacecraft travel, then it is short and according to Han Solo, something to brag about. If it were a database table recording many different distances without knowing locations, 12 parsecs could be just another distance.
What is a database table?
A database table contains data. When you first see one, you may even think it is a list of items. Or if you have worked with spreadsheets, it may even look like a spreadsheet.
We create multiple tables in a database to store data that is related to each other.
These tables can be built on themes. You can have a character table, a planet table, a spacecraft table, etc..
Tables are made up of rows and columns. The column headers are known as attributes. They help describe whatever the theme of the table is.
Below is an example database table with Star Wars data. The table is storing Star Wars vehicle data. Notice how the columns are characteristics that would help describe or add detail to a vehicle.
One of biggest mistakes anyone building their first database does, is create what is known as a ‘flat file’. A flat file is a sprawling list. You can create such lists in a word processing document but then you cannot easily manipulate the list without many edits. You can also create them in a spreadsheet like Microsoft Excel but that too will lead to issues with managing your data.
Another mistake is making one large database table. This leads to the issues or anomalies but it gives developers a false sense that they now have a database.
What is a database anomaly? A little bit of database theory...
Anomaly Examples Using Jedi
Insertion anomalies are when you want to store data but you put it in several different places. You know that Jedi have skills. At first they may have one skill. However, a bad database design has you storing this one skill in several different tables. That can then lead to…..
Update anomalies. These will happen when you want to update this skill. You have to make sure you find all places where this skill is stored and make changes to it.
Deletion anomalies. This can happen when you realize a Jedi no longer possesses a skill and you decide to remove it from them. But the skill is also used by other Jedi. If you delete it you may be removing it from other Jedi who have it.
You can avoid these anomalies.
The result is have various tables containing data that is related so when you use that data you easily and quickly find it or store it in the correct spot.
To avoid these error causing anomalies, we go through the process of normalizing the data. Normalization is a series of steps that allows you to create database tables that are related to one another.
I will cover NORMALIZATION in another post.
Below is an example of two tables that are related.
The table on the right, “vehicle”, is related to the table on the left, “vehicleclass”.
Where does SQL fit into all this? A short answer.
To display data in a database, software programmers use Structured Query Language (SQL).
Data can come from three places when using software programs. It can come directly from the person entering into the program, created by a device such as a sensor collecting data, or it information can be pulled from a database.
Example: SQL used in the Play Disney App – Star Wars Galaxy’s Edge
Do you have a user account on a website or app such as the Play Disney app used in Walt Disney World Galaxy’s Edge? If you remember, you probably created your account by providing a name, email address, and password. When you clicked the submit button on the webpage, it took your information and inserted it into a user account table. Inserting the data was done with a SQL Command called “INSERT”.
Now when you login to that webpage or smartphone app next time you visit, you provide your login information (eg your name and password). The webpage uses a SQL Command called “SELECT” that then takes your information and looks to compare it to what is already stored in the user account table.
If you are logged into your account on that webpage and you want to change your email address, this can be done behind the scenes in the code using a SQL Command called “UPDATE”.
These commands and several others are all being done by your programming code. There are many others.
How do I build a database?
Building a database can be alot of fun especially if the data you are working with is something you are interested and building a database today is easier than it has ever been.
Be sure to visit the COURSES at https://courses.getmecoding.com to learn more.
There are several general steps you can follow so you don’t go off track when building your database.
Software for Building Databases
Free and Paid VersionsThe list of software below has FREE and PAID versions. Most have a developer version that you can install on your PC and still have a full range of capabilities.
Database software can be placed into one of the following categories. These categories tend to get ‘grey’ but they generally fit into these categories:
The Rebels – Personal (Desktop)
The Galactic Empire – Enterprise (Centralized/Distributed)
Personal Databases (or as I refer to them…The Rebels)
I refer to them as the Rebel database systems. Like the Rebels, they are effective but not very large and limited in capabilities. Listed in no particular order, these are great for projects where:
- you don’t plan on having a lot of users access your data
- you want to move it from computer to computer or physically hand it off to someone
- you want to get up and running fast
- Keeping a list of work for your R2 Units
- Create an inventory of parts for your moisture vaporators
- Managing maintenance on your T-16
Microsoft Access – Available as part of the Office 365 collection. Not designed for a large number of users and does not have a free version. Works great with all the Microsoft Office software programs and connects well when working with the .NET software development.
FileMaker Pro (now Claris) – Are you are Macintosh user? Then you probably know about this one as it is commonly used by Apple computer owners. Not a good option if you plan on serving hundreds of users on the internet.
LibreOffice Base – Base is not as advanced as Microsoft Access and hard to grow it (scale it). But it is FREE and available for all the top operating systems (Microsoft, Linux, and Macintosh). It is also compatible some of the mid-range software programs such as MySQL and PostgresSQL.
Enterprise Databases (or the Galactic Empire)
Much like the Empire, large, scalable, and capable, enterprise databases are used for organizations and companies. These not only require you to have database creation knowledge but you will also need to have knowledge about how computer servers work. These systems can be characterized as:
- you plan on having many users access your data
- you plan on using it behind internet based systems
- you anticipate it growing over time
- Tracking the military activities throughout the galaxy
- Provide the system for tracking New Republic activities
- Managing maintenance orders for your fleet of attack fighters
Yes, there are others.
Like the Star Wars Galaxy itself, database technology is EXPANSIVE but starting out does NOT have to be. There are more options than what I presented here but these are the ones that come up quite frequently. I will cover the “cloud based” options such as Amazon and Azure in a later post.
Happy coding and MAY THE FORCE BE WITH YOU!
Start Coding Today In 5 Minutes!
Take 5 minutes and try a FREE coding activity!
Let Me Help You
If you are a teacher or someone looking to help others learn to code, let me help you.