Start studying
Module 5 · SQL Module contents
Module 5  ·  Card 2 / 14beginner

The SELECT Statement

The SELECT statement is the foundational command used to query and retrieve data from database tables.

It pairs with the FROM clause to specify which table contains the records you wish to retrieve.

You can list specific column names separated by commas to return only the attributes required for your analysis.

Alternatively, SELECT * retrieves every column in the table without naming each one.

SELECT also allows you to rename columns with aliases and perform arithmetic calculations directly on numbers as they are read.

Learn in depth ↓
Module 05 · SQL · 14 concepts
In depth  /  15 lines

The SELECT Statement, in more detail

The SELECT statement forms the core data retrieval operation in the declarative Structured Query Language.

Declarative languages allow analysts to describe what data they want, leaving execution strategies to the database engine.

When querying, the FROM clause identifies the target table, establishing the working dataset for the query.

Specifying explicit column names in the SELECT clause is a best practice known as column projection.

Column projection reduces network bandwidth and memory overhead by avoiding the transfer of unneeded attributes.

Using SELECT * requests all columns defined in the table schema, which is convenient during early exploration.

However, using SELECT * in production queries is fragile, because table schema changes can break downstream pipelines.

The AS keyword assigns aliases to columns, renaming output fields for clearer reporting and dashboard integration.

SELECT can also evaluate mathematical expressions, such as calculating profit by subtracting cost from revenue directly.

Built-in scalar functions allow text formatting, date parsing, and numerical rounding during row projection.

The DISTINCT keyword eliminates duplicate rows from the final result set, returning only unique value combinations.

Under the hood, the query optimiser parses the statement, constructs an execution plan, and requests blocks from storage.

Although SELECT appears first in SQL syntax, the database engine actually processes the FROM clause before projecting columns.

Understanding this internal order of operations helps analysts write efficient queries that leverage database indexes.

A common error is attempting to filter rows using aliases created within the same SELECT statement, which fails in WHERE clauses.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
An analyst writes a query to inspect customer names and purchase amounts from an orders table. How should the SELECT statement be structured?
SQL

14 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close