Lesson 2: Basic SELECT Statements
What is the SELECT Statement?
The SELECT
statement is the most commonly used SQL command. It allows you to retrieve specific data from a database table.
SQL
SELECT * FROM customers;
Selecting Specific Columns
You don’t always need all the data. You can specify which columns you want to retrieve:
SQL
SELECT first_name, email FROM customers;
Using Aliases
Aliases let you rename columns for better readability.
SQL
SELECT first_name AS "First Name", email AS "Email Address"
FROM customers;
Execution Order
Even though you write SELECT
first, the database actually processes the FROM
clause first.
Practice Quiz
Test your understanding of the SELECT statement: