...
The following SQL statement selects the “firstname“ firstname
and “surname“ surname
of all the people from the country "Mexico"‘Mexico’, in the "people
" table and then sorts by surname
in ascending order DESC
(default descending order by behaviour):
Code Block | ||
---|---|---|
| ||
SELECT firstname, surname FROM people WHERE country = 'Mexico' ORDER BY surname |
...
The following SQL statement selects the “firstname“ firstname
and “surname“ surname
of all the people from the country "Mexico"‘Mexico’, in the "people
" table and then sorts by surname
in desc ASC
(ascending order (- the default):
Code Block | ||
---|---|---|
| ||
SELECT firstname, surname
FROM people
WHERE country = 'Mexico'
ORDER BY surname DESC |
Example Ascending order (multiple columns)
The following SQL statement selects the “firstname“ firstname
and “surname“ surname
of all the people from the country "Mexico"‘Mexico’, in the "people
" table and then sorts by surname
in DESC
(descending) order and then firstname
in ASC
(ascending order (- the default):
Code Block | ||
---|---|---|
| ||
SELECT firstname, surname
FROM people
WHERE country = 'Mexico'
ORDER BY surname DESC, firstname ASC |
Info |
---|
It is also possible to reference your columns numerically int he order they appear in the select statement e.g. |
...