Say “Hello” to the Table
Run your first SQL query and view full table data.
We'll cover the following...
Welcome to SQL. In this first lesson, you’ll write a simple query to interact with a table and retrieve data—no setup or background required. Let’s get started with your first real query.
Goal
You’ll aim to:
Run your first SQL query.
View a whole table using
SELECT *
.Understand the idea of a table as structured data.
Meet the table
Let’s start with a table called people
that stores basic info about different individuals, like their name
, age
, and city
. Here’s what it looks like:
The people
table
ID | Name | Age | City |
1 | Aisha | 30 | Karachi |
2 | Dan | 24 | New York |
3 | Fatima | 27 | Lahore |
4 | Lee | 22 | Seoul |
Say hello with SELECT *
You’re asking SQL to show everything from the people table: every column, every row.
SELECT * FROM people;
Congratulations! You just pulled an entire table using one line of code!
📝 Did you know?
This query works just fine without the semicolon at the end—it’s optional in many environments when running a single statement. And it also works even if you write it in lowercase. That’s because SQL is case-insensitive, soselect
,SELECT
, or evenSeLeCt
all mean the same thing.
Quick bits
SELECT
: Ask for columns*
: Wildcard for all columnsFROM
: The table you're asking
Mini challenge
Try this with a second sample table called pets
:
# Write SQL query to fetch data for pets table
If you’re stuck, click the “Show Solution” button.
Great, you did it! Now you know how to query any table.
Th pets
table
The pets
table stores information about different animals, like their name
, type
, and age
.
ID | Name | Type | Age |
1 | Coco | dog | 5 |
2 | Luna | cat | 3 |
3 | Goldie | fish | 1 |
View all entries in the pets
table.
What’s next?
Now that you have viewed the entire table, let's focus on how to select specific columns of interest. Next, learn how to select only the columns that are relevant to your query.