1.1

The Five Clauses of the SELECT Statement

The Five Clauses of the SELECT statement

The clauses MUST appear in the order shown above.

Code Example:1    USE world;
2    SELECT name
3    FROM city
4    WHERE CountryCode = “AFG”
5    ORDER BY name
6    LIMIT 3

Results:

Retrieve_data_from_a_single_table_example1.png

Let us break the statement line by line:

USE world;

SELECT name

FROM city

ORDER BY name

LIMIT 5;

Table 1. Column Specifications

Source Option Syntax

Base Table Value

Show all columns

 

Base Table Value

Column Name

Comma-separated list of column names

Calculated Value

Calculation result

Arithmetic expression

Calculated Value

Calculation result

Functions