100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
SQL

SELECT Statement Basics

Learn how to retrieve data from a table using the SELECT statement, the foundation of every SQL query.

SQL BasicsBeginner8 min readJul 8, 2026
Analogies

Introduction

The SELECT statement is the most fundamental command in SQL. It is used to read and retrieve data from one or more tables in a relational database. Every report, dashboard, or application query that displays data ultimately relies on a SELECT statement.

🏏

Cricket analogy: Just as a scorecard is the base document every commentary and highlight reel is built from, SELECT is the base command every dashboard and report in an application ultimately relies on to pull data.

Syntax

sql
SELECT column1, column2, ...
FROM table_name;

-- To select all columns
SELECT *
FROM table_name;

Explanation

The SELECT clause lists the columns you want returned, separated by commas. The FROM clause specifies which table to read from. Using an asterisk (*) instead of column names returns every column in the table, which is convenient for exploration but should be avoided in production code because it can return more data than needed and breaks if the table schema changes.

🏏

Cricket analogy: Calling for the full scorecard with every statistic (SELECT *) when you only need runs and wickets is wasteful, just as listing only first_name, last_name, department is more efficient than pulling every column.

Example

sql
-- employees table: id, first_name, last_name, department, salary, hire_date

SELECT first_name, last_name, department
FROM employees;

Output

The query returns a result set with three columns (first_name, last_name, department) and one row for every employee stored in the table, for example: 'Alice | Nguyen | Engineering', 'Ben | Osei | Marketing', and so on.

🏏

Cricket analogy: The result set listing every employee's name and department row by row is like a team sheet listing every player's name and role, one line per player, in the order the sheet was compiled.

Key Takeaways

  • SELECT retrieves data; it does not modify the underlying table.
  • Use SELECT * only for quick exploration, not in production queries.
  • Column order in the result set matches the order listed after SELECT.
  • You can compute expressions and aliases directly in the SELECT list, e.g. SELECT salary * 12 AS annual_salary.

Practice what you learned

Was this page helpful?

Topics covered

#SQL#DatabaseSQLStudyNotes#Database#SELECTStatementBasics#SELECT#Statement#Syntax#Explanation#StudyNotes#SkillVeris