mysql order by clause
DESCRIPTION
Aggregate functions, Order by clause, Having Clause, Distinct ClauseTRANSCRIPT
Aggregate FunctionsOrder by clauseHaving ClauseDistinct Clause
Count
Max
Min
Avg
Sum
The default sort order is ascending, with
smallest values first.
To sort in reverse (descending) order, add
the DESC keyword to the name of the
column you are sorting by:
SELECT ordernumber , itemsCount ,
sum(priceeach) AS total FROM orderdetails
GROUP BY ordernumber
order to remove the duplicate rows, we
use the DISTINCT operator in the SELECT
statement.
General Syntax
SELECT DISTINCT columns
FROM table_name
WHERE where_conditions
SELECT lastname FROM employees
ORDER BY lastname
SELECT DISTINCT lastname FROM employees
ORDER BY lastname