Believe it or not, the headline is quite literal. Real men and women do in fact use SQL. Even if you’re not aware of it, SQL plays a role in your life. Quietly hiding behind the scenes, delivering the information that you need to get through the day.
It’s unfortunate that SQL gets so little credit for all the work it does. But today we’re going to change that. Today is the day that SQL starts getting the credit it deserves.
In this article, we're going to give you a brief history (really brief, I promise) of SQL and then we're going to jump right into how and where SQL is used. In case I spark an interest, I’ll finish up by providing some resources where you can start learning more.
A Brief History of SQL
Depending who you're talking to, you may find SQL (Structured Query Language) referred to by it’s actual letter names or possibly as “sequel”. Originally a product of IBM, SQL came about in the 1970s as a result of a problem. IBM needed to find a way of communicating with and manipulating the information found in databases.
Since the 1970s, SQL has become the standard worldwide language used to communicate with relational databases. Before the advent of relational databases, we relied primarily on a more complex model called hierarchical. I've linked to that term because if we spend too much more time on this topic, I'll have broken my promise.
Let's move on to some more useful details.
What is a Database?
The simplest definition we can come up with is that a database is an organized collection of data. Imagine taking the name, address, phone number, and zip code of every person who lives in your city and dropping them into a large bucket. But we're going to be more specific about this process. Write the information for each person on a single piece of paper before dropping them into your bucket. Nice work, you now have a bucket that contains thousands of pieces of information.
Now, give your bucket a shake, making sure your pieces of paper are well mixed. That bucket is essentially your database and it’s not unlike the typical database contained on your computer or smartphone.
You can see where we're going with this right? You've now created a small problem. You have a bucket (database) that is full of useful information, but how do you get that information out of the bucket in an efficient manner so that it's usable?
How is SQL related to Your Database?
Sticking with our bucket of names and addresses, let’s imagine now that you have an empty phone book that is connected to your bucket. How do you get the information from your bucket – which is essentially a jumbled mess – into your phone book in a usable, readable manner? SQL to the rescue.
SQL is the language capable of communicating with your database. It does this by generating what is called a “query”. For example, show the results for every person in my database who:
- Has a last name that begins with the letter A
- Has the zip code 785241
All of a sudden you're now able to begin extracting useful information from your database. You can essentially create any type of query you want and SQL will return the appropriate information to your phone book for you to see.
Over time, your database will grow to contain more names or even additional information – such as household income. You can continue using SQL to communicate and extract the information you need. SQL will even put the information into the bucket for you.
A Real World Example
Most of us will never find ourselves in a position where we're having to create SQL queries directly. But that doesn't mean you're not using a database or SQL. Thankfully, we have programs or apps that do all the heavy lifting for us.
The contact manager that you have on your computer is one such application. To make your life easier, the application has what is called a graphical user interface (GUI for short). When you look at your screen, this GUI is what you are seeing. If you were to click on the letter “V”, your application would send a request via SQL to your database saying “I am requesting all of the entries that have a last name starting with the letter V”.
Magically, your contact manager now displays a list of every person in your database with the applicable last name. This is obviously a simplified version, but I think it makes the process a little easier to understand.
There are essentially four actions that your GUI can allow you to perform on your database. They are:
- Modify an existing database entry – your friends address changed.
- Insert a new entry into the database – you made a new friend.
- Remove an entry from the database – you've unfriended someone.
- Request information from the database – you're trying to find the phone number for a specific friend.
Although your interactions are limited to these four categories, you still have an amazing amount of power at your fingertips when it comes to manipulating the data.
Where Can You Learn More?
Although SQL and database management certainly seems like a dry topic, it’s essential to our daily lives. Without SQL, as a society we could probably turn the clock back at least 40 years. That’s right, back to the days of a Rolodex.
If this post has sparked an interest in SQL, there are some great resources available to help you learn more.
Most have us have referred to W3school for help with CSS and HTML. It just so happens that they have a great resource available for learning about SQL as well. Having said that, it might not be the best resource for beginners. It is fairly direct and does not have examples that are suited to the layperson. If you’re someone who learns visually and auditorily, our next source may be a better fit.
Udemy offers some great courses that can help you learn more about SQL. There are several free courses available, but the higher quality ones come with a small fee attached. If you’re serious about learning some basic SQL skills, this is where you probably want to be.
Hopefully, this post has given you a very basic introduction into what exactly SQL is and how important it is to our lives. If you stop to think about it for just a few seconds, you’ll realize just how much we depend upon data every single day.
Learning to use and manipulate that data is an incredibly valuable skill so if we've sparked an interest, take the time to learn more.
If you've ever used an interface like MySQL, please share your experiences in the comments.