Skip to content

SELECT

In one line

SELECT is the SQL command that reads data from a database — it specifies which columns to return and from which table.

In simple words

SELECT is the most common SQL command. It retrieves rows from one or more tables and returns them as a result set. The basic form is:

SELECT column1, column2 FROM table_name;

You can filter rows with WHERE, sort with ORDER BY, limit with LIMIT, aggregate with GROUP BY, and join with JOIN. The * wildcard selects all columns.

SELECT never modifies data — it is read-only. This makes it safe to experiment with. The order of clauses matters: SELECT → FROM → WHERE → GROUP BY → HAVING → ORDER BY → LIMIT.

Example

sql
-- Select specific columns, filter, and sort
SELECT name, email
FROM users
WHERE active = TRUE
ORDER BY created_at DESC
LIMIT 10;

Returns the name and email of the 10 most recently created active users.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary