Hello, Data! Meet SQL
Learn the fundamentals of SQL to efficiently query and filter data stored in relational databases.
Spreadsheets are great, CSVs are common, and APIs stream data from everywhere—but when companies need structure, speed, and scale, they often rely on relational databases. These are like powerful digital filing cabinets where data lives in neatly organized tables—rows and columns designed for efficient storage and retrieval.
But these tables don’t do much on their own. To explore them, ask questions, and pull insights, we need a universal language for data: SQL—Structured Query Language.
SQL isn’t a programming language—it’s a declarative language.
SQL is how we talk to relational databases. It’s how we ask for the data we want, filter the noise, and shape results into meaningful answers. Whether you're analyzing employee salaries, tracking customer orders, or prepping data for machine learning models—SQL is a tool you'll reach for again and again.
Fun fact: The first version of SQL was developed at IBM in the 1970s. It originally stood for "Structured English Query Language" (SEQUEL)—which is why some people still pronounce it “sequel” today!
In this lesson, we’ll explore the fundamental building blocks of SQL queries—how to select data, apply filters, and return only what’s relevant.
Sample data: The Employees table
To understand how SQL works, let’s start with a simple example table called employees. It stores information about employees in a company, including their ID, name, department, hire date, and salary.
EmployeeID | Name | Department | HireDate | Salary |
1 | Alice Johnson | Engineering | 2020-03-15 | 85,000.00 |
2 | Bob Smith | Marketing | 2019-07-22 | 65,000.00 |
3 | Carol Martinez | Sales | 2021-01-08 | 72,000.00 |
4 | David Liu | Engineering | 2018-11-02 | 95,000.00 |
5 | Eva Gómez | HR | 2022-05-16 | 58,000.00 |
6 | Frank O’Connor | Finance | 2017-09-30 | 78,000.00 |
7 | Grace Patel | Engineering | 2023-02-12 | 80,000.00 |
8 | Hiro Tanaka | Support | 2020-12-01 | 60,000.00 |
9 | Isabella Rossi | Marketing | 2021-06-25 | 67,000.00 |
10 | Ayra Stark | Sales | 2019-04-10 | 71,000.00 |
This table will help us explore the core building blocks of SQL.
Pulling what you need: SELECT
and FROM
When we start querying a database, two SQL clauses are essential: SELECT
and FROM
. They work hand-in-hand to tell the database what data we want and where to find it.
Fun fact: SQL is case-insensitive, but people often write keywords in UPPERCASE to make queries easier to read.
SELECT
is how we specify the exact columns—or pieces of information—we want to see in our ...