Table of Contents |
Every day, companies around the world collect massive amounts of data, such as customer interactions, sales transactions, and social media activity. This immense collection is commonly referred to as big data. However, despite the vast amounts of information businesses accumulate, research suggests that organizations typically analyze only about 1% of their data effectively. The remaining 99% remains unused, not because it isn’t valuable but because companies often lack the skills or tools to efficiently explore and retrieve actionable insights.
That’s where database skills, especially SQL (Structured Query Language), become crucial. SQL allows IT professionals to directly and efficiently retrieve precisely the information they need, turning overwhelming quantities of data into valuable, actionable insights.
In this lesson, you’ll begin developing the foundational SQL skills necessary to overcome the 1% challenge. You’ll practice applying basic SQL commands to extract useful information from databases, allowing you to understand how businesses are transforming data into opportunities for informed decision-making.
Before you can start writing SQL queries, it’s important to understand how data is organized inside a database.
A database is a structured system for storing information. Think of it like a digital filing cabinet that holds large amounts of data in a way that makes it easy to find specific details when needed. Inside a database, information is stored in tables. These tables look similar to spreadsheets, with rows and columns.
Each row in a table represents one individual item, such as a customer, an order, or an employee. Each column contains a specific type of information, such as a name, date, or location. For example, a table called “Employees” might include columns for name, department, and salary, and each row would show the details for one person.
To find specific information in a database, professionals use a special tool called SQL, which stands for Structured Query Language. SQL is the language used to talk to databases. It lets you search, filter, and organize data using short, clear commands.
Instead of scrolling through thousands of rows manually, you can write a simple SQL command to pull out just the data you need. For example, you could use SQL to find all the customers who made a purchase last week or to list the employees in a certain department.
In the next section, you’ll start learning how to write these kinds of commands yourself. For now, just remember this: databases store information in tables, and SQL is how we ask questions about that information to get useful answers.
Now that you know how databases store information in tables made up of rows and columns, you’re ready to start learning how to work with that data. To do that, you will use SQL, the language designed to ask clear, specific questions and return exactly the information you need.
The most common SQL command is SELECT. It tells the database what information you want to retrieve.
SELECT column_name FROM table_name;
This command means “Show me the values in this column from this table.”
EXAMPLE
Let’s say we have a table called Employees with the following data:Name | Department | Salary |
---|---|---|
Rosa | IT | 65,000 |
Malik | Sales | 55,000 |
Jenna | Marketing | 60,000 |
Let’s look at this SQL command:
SELECT Name FROM Employees;
This comand asks the database to return the Name column from the Employees table. The result would be:
Rosa
Malik
Jenna
Given the following SQL command:
SELECT Department FROM Employees;
In the next section, you’ll learn how to filter results using WHERE to narrow down your search. This lets you be more specific about the data you want to see.
Sometimes, you don’t want to see all the data in a table. You might only want to see employees in the Sales department or products that cost more than $50. That’s where the WHERE clause comes in.
The WHERE command lets you filter the results of your query by setting a condition. It helps you focus on just the rows that match what you’re looking for.
SQL Structure
SELECT column_name FROM table_name WHERE condition;
This command means that you want to be shown this column from this table, but only if the data meets this condition.
EXAMPLE
Let’s use the same Employees table:Name | Department | Salary |
---|---|---|
Rosa | IT | 65,000 |
Malik | Sales | 55,000 |
Jenna | Marketing | 60,000 |
Let’s say you want to see only employees who work in the Sales department.
SELECT Name FROM Employees WHERE Department ="Sales";
This query returns the following:
Malik
The WHERE clause told SQL to ignore any rows where the Department was not “Sales.”
SELECT Name FROM Employees WHERE Salary > 58000;
As your ability to ask questions with SQL grows, you’ll start to work with more specific conditions. That’s when you’ll need to combine filters to narrow or expand your results, and that’s exactly what you’ll do next.
So far, you’ve used WHERE to filter results based on a single condition. But most questions involve more than one. You might want to find employees who work in Sales and earn more than $50,000, or customers who live in New York or Chicago. To write queries like these, you’ll use two new helpful keywords. These keywords let you combine two or more conditions in a single query, giving you more control over what data is returned.
The keyword AND lets the database know that both conditions must be true for a row to be included in the results.
For example, imagine this table:
Name | Department | Salary |
---|---|---|
Rosa | IT | 65,000 |
Malik | Sales | 55,000 |
Jenna | Marketing | 60,000 |
Brian | Sales | 49,000 |
If you want to find employees who are in Sales and have a salary greater than 50,000, you would write as follows:
SELECT Name FROM Employees
WHERE Department = "Sales" AND Salary > 50000;
The database checks each row. Only Malik meets both conditions. Brian works in Sales, but his salary is too low. Everyone else is in a different department.
When you use OR, you’re saying that either condition can be true. If one matches, that’s enough.
Here’s an example:
SELECT Name FROM Employees
WHERE Department = "Sales" OR Department = "Marketing";
This query returns any employee who is in Sales or Marketing. That includes Malik, Jenna, and Brian.
Even though Brian’s salary is under 50,000, he’s still in Sales, so he qualifies. Jenna is in Marketing, so she qualifies too.
SELECT Product FROM Products
WHERE Category "Electronics" AND Price > 500;
SELECT Product FROM Products
WHERE Category "Furniture" OR Price < 500;
SELECT Title FROM Books
WHERE Price > 20 AND Author "Kim Lang";
Product | Category | Price |
---|---|---|
Laptop | Electronics | 900 |
Chair | Furniture | 120 |
Phone | Electronics | 600 |
Desk | Furniture | 300 |
Tablet | Electronics | 400 |
To really understand the impact of SQL and how it is used, it is helpful to understand how each part of a query works to answer a specific question. Even if you’re not writing full SQL statements yet, seeing how they’re structured can build your confidence and help you recognize what different commands are doing. The following example shows how SQL helps professionals pull useful information from a database, one clear step at a time.
EXAMPLE
Let’s say you work in an online bookstore and want to find out which books cost more than $20 and were written by Kim Lang. Instead of scrolling through every product manually, you can use an SQL query to pull exactly what you need from the database.Title | Author | Price |
---|---|---|
Code Breakers | Kim Lang | 18.99 |
Debugging Life | Marcus Trent | 22.50 |
SQL for Starters | Riley Chen | 25.00 |
Data Dive | Aisha Grant | 19.95 |
Advanced SQL | Kim Lang | 24.99 |
If you found it interesting to break down tasks into step-by-step logic or enjoyed spotting and fixing errors, you are already thinking like a programmer. Skills like writing pseudocode and debugging are not just for coding; they are essential in many IT careers, including software development, data analysis, cybersecurity, and DevOps. If this kind of thinking appeals to you, consider taking an introductory programming course such as Intro to Python or Intro to Java. These classes build directly on what you have practiced here and can help you take the next step toward a technical career path.
Source: THIS TUTORIAL WAS AUTHORED BY SOPHIA LEARNING. PLEASE SEE OUR TERMS OF USE.