Quick answer

The SELECT statement is used to retrieve data from a database table. It is the most important SQL command because nearly every query starts with it.

SELECT column_name
FROM table_name;

In simple terms:

  • SELECT tells SQL what data you want
  • FROM tells SQL where to get it
Tip: If you are reading data and not changing anything, you are almost always using SELECT.

In this guide

Sample table

Imagine you have this table called employees:

employee_id name department salary city
1 Ana Sales 62000 Chicago
2 Ben IT 78000 Dallas
3 Chris HR 56000 Chicago
4 Dana IT 85000 Denver
We’ll use this table in the examples below so you can see exactly what each SELECT query returns.

Why SELECT matters

The SELECT statement is the foundation of SQL. Before you learn joins, grouping, ordering, or updates, you need to understand how to retrieve data correctly.

In real work, SELECT is used for things like:

  • showing a list of customers
  • finding employees in a certain department
  • viewing salaries, dates, names, or totals
  • checking records before making changes with UPDATE or DELETE
Beginner rule: learn SELECT well first. Almost every other SQL skill builds on top of it.

Select all columns

You can retrieve every column in a table with an asterisk.

SELECT *
FROM employees;

This returns all columns and all rows from the employees table.

employee_id name department salary city
1 Ana Sales 62000 Chicago
2 Ben IT 78000 Dallas
3 Chris HR 56000 Chicago
4 Dana IT 85000 Denver
SELECT * is useful for quick exploration, but in real projects it is usually better to select only the columns you actually need.

Select specific columns

Most of the time, you do not need every column. You can request only the ones you want.

SELECT name, salary
FROM employees;

This returns just the employee name and salary.

name salary
Ana 62000
Ben 78000
Chris 56000
Dana 85000
Best practice: only select the columns you actually need. This keeps queries cleaner and often performs better.

Use WHERE to filter rows

A basic SELECT query returns all rows unless you filter them. The WHERE clause lets you choose only rows that match a condition.

SELECT name, salary
FROM employees
WHERE salary > 60000;

This returns only employees with a salary above 60000.

name salary
Ana 62000
Ben 78000
Dana 85000
If SELECT answers “what columns do I want?”, WHERE answers “which rows do I want?”

Use aliases

Aliases let you rename columns in your result. This is helpful when the original column name is too technical or when you want a cleaner output label.

SELECT name AS employee_name, salary AS annual_salary
FROM employees;

This changes the labels shown in the result to employee_name and annual_salary.

Aliases do not change the real table structure. They only change how the result is displayed.

Use ORDER BY

Results are not guaranteed to come back in a meaningful order unless you sort them. That is what ORDER BY is for.

SELECT name, salary
FROM employees
ORDER BY salary DESC;

This sorts employees from highest salary to lowest salary.

name salary
Dana 85000
Ben 78000
Ana 62000
Chris 56000
DESC means descending. Use it when you want the biggest values first.

Use LIMIT

Sometimes you only want the first few results instead of everything. The LIMIT clause helps with that.

SELECT name, salary
FROM employees
ORDER BY salary DESC
LIMIT 2;

This returns only the top 2 highest salaries.

name salary
Dana 85000
Ben 78000
ORDER BY and LIMIT are often used together for “top results” queries.

Common mistakes

  • using SELECT * everywhere, even when only a few columns are needed
  • forgetting WHERE when filtering is required
  • assuming results come back in a stable order without ORDER BY
  • selecting too many columns and making the result harder to read
  • confusing aliases with real column names
SQL does not guarantee row order unless you explicitly use ORDER BY.

Practice questions

1. Select all columns from the employees table.
2. Select only employee names and salaries.
3. Select employees with salary above 70000.
4. Sort employees by salary highest to lowest.
5. Return only the top 2 salaries.

Bottom line

The SELECT statement is the core of SQL. Once you understand how to select columns, filter rows, sort results, and limit output, you are ready to build much more advanced queries.

Quick memory trick: SELECT = what columns, FROM = what table, WHERE = what rows.

Related SQL tutorials

SQL Hub
Start here for all SQL topics and tutorials.
WHERE Clause
Learn how to filter rows after selecting data.
ORDER BY
Learn how to sort query results correctly.
GROUP BY
Learn how to group selected data into summaries.