SQL FOUNDATIONS:SQL SELECT Statement

Learn how to retrieve data from a database using the SQL SELECT statement. This chapter introduces the core syntax of SELECT, how to choose specific columns, and how to query all data from a table.

SQL SELECT Statement

The SELECT statement is the most fundamental command in SQL. It allows you to retrieve data stored in database tables.

Every query that reads data begins with SELECT.

Basic Syntax

SELECT column1, column2 FROM table_name;

You can also retrieve all columns using the wildcard (*).

SELECT * FROM table_name;

Example Table

idnameage
1John25
2Sarah30
3Mike22

Example Query

SELECT name, age FROM users;

This query returns only the name and age columns from the users table.

When to Use SELECT

Use SELECT whenever you want to:

  • View stored data
  • Filter results
  • Analyze records
  • Prepare reports

SQL SELECT Statement Missions

Solve exercises in sequence to unlock the next mission.