Say “Hello” to the Table
Explore the fundamentals of SQL in this introductory lesson by running your first query to retrieve all data from a sample table. Understand what a table is and how to ask SQL to show information, building a solid foundation for further database learning.
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 information 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.
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 evenSeLeCtall mean the same thing.
Quick bits
SELECT: Ask for columns.*: Wildcard for all columns.FROM: The table you’re asking.