SELECT & FROM
Retrieve columns from a table — the simplest complete SQL query
Knowledge Debt detected
You can study this freely — but your score may plateau if these foundations have gaps. The Mastery badge requires them to be solid.
Explanation
SELECT retrieves data from a database table. Combined with FROM, it's a complete, runnable query.
SELECT name, email
FROM users;The two required parts:
- 1.
SELECT— which columns to return - 2.
FROM— which table to read from
Selecting all columns with the * wildcard: ``sql SELECT * FROM users;
Renaming a column in the output with AS: ``sql SELECT name AS full_name FROM users;
SQL keywords (SELECT, FROM) are case-insensitive — select works the same as SELECT — but uppercase is the convention for readability.
Examples
Selecting specific columns
Returns only the id, name, and email columns for every row in users
SELECT id, name, email
FROM users;How well did you understand this?
Next in SQL & Databases
Filtering with WHERE