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

CC BY-NC-ND International 4.0

CC BY-NC-ND International 4.0: This work is released under a CC BY-NC-ND International 4.0 license, which means that you are free to do with it as you please as long as you (1) properly attribute it, (2) do not use it for commercial gain, and (3) do not create derivative works.