Fundamentals

The SQL SELECT Statement: A Beginner's Guide

7 min read · Updated August 13, 2026

Almost every SQL query you'll ever write starts with the same word: SELECT. It's how you ask a database to hand you rows of data. This guide walks through the SELECT statement piece by piece, using a simple Employees table as the running example. Every snippet below can be pasted straight into the SQL Practice playground, which already has this exact table loaded.

The basic shape

A SELECT statement has two required parts: which columns you want, and which table to get them from.

SELECT column1, column2
FROM table_name;

To get every column without typing each name, use the asterisk wildcard:

SELECT * FROM Employees;

This is convenient while exploring a table, but in real applications it's better practice to name the columns you actually need — it makes the query's intent clear and avoids pulling data you'll never use.

Choosing specific columns

SELECT first_name, last_name, salary
FROM Employees;

The column order in your SELECT list controls the column order in the result — it doesn't need to match the table's original definition.

Renaming columns with AS

The AS keyword gives a column (or an expression) a friendlier name in the output, called an alias. It doesn't rename anything in the actual table.

SELECT
    first_name AS "First Name",
    salary AS annual_salary
FROM Employees;

Aliases are especially useful once you start using calculations or aggregate functions, where the raw expression makes an ugly column header:

SELECT
    first_name,
    salary,
    ROUND(salary * 12, 0) AS annual_salary
FROM Employees;

Removing duplicates with DISTINCT

If a column has repeated values and you only want to see each one once, add DISTINCT right after SELECT:

SELECT DISTINCT dept_id
FROM Employees;

DISTINCT applies to the combination of every selected column, not each column independently. So SELECT DISTINCT dept_id, manager_id returns each unique pair of department and manager, not each unique department followed by each unique manager separately.

Sorting results with ORDER BY

Rows come back in no guaranteed order unless you ask for one. ORDER BY sorts ascending by default:

SELECT first_name, salary
FROM Employees
ORDER BY salary DESC;

Use ASC (default, so usually omitted) for low-to-high, and DESC for high-to-low. You can sort by multiple columns — the second column only breaks ties in the first:

SELECT dept_id, first_name, salary
FROM Employees
ORDER BY dept_id ASC, salary DESC;

Limiting how many rows come back

LIMIT caps the number of rows returned — handy for previewing a large table or grabbing a "top N" list once combined with ORDER BY:

SELECT first_name, salary
FROM Employees
ORDER BY salary DESC
LIMIT 3;

That query returns the three highest-paid employees — LIMIT is evaluated after ORDER BY, so the sort happens first.

Putting it together

A more complete example, combining everything above:

SELECT
    first_name,
    last_name,
    dept_id,
    ROUND(salary, 0) AS salary
FROM Employees
ORDER BY salary DESC
LIMIT 5;

Try it yourself

Open the SQL Playground — the Employees table is already loaded, so you can paste any query above and run it immediately.

Open the Playground

Where to go next

Once SELECT feels comfortable, the next step is filtering rows with WHERE, then combining data from multiple tables with JOINs: