Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Aggregate Functions
Order by clause
Having Clause
Distinct 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 key...
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...
SELECT lastname FROM employees
ORDER BY lastname
SELECT DISTINCT lastname FROM employees
ORDER BY lastname
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Mysql order by clause
Upcoming SlideShare
Loading in …5
×

Mysql order by clause

377 views

Published on

Aggregate functions, Order by clause, Having Clause, Distinct Clause

Published in: Education, Spiritual, Technology
  • Be the first to comment

  • Be the first to like this

Mysql order by clause

  1. 1. Aggregate Functions Order by clause Having Clause Distinct Clause
  2. 2. Count Max Min Avg Sum
  3. 3. 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:
  4. 4. SELECT ordernumber , itemsCount , sum(priceeach) AS total FROM orderdetails GROUP BY ordernumber
  5. 5. 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
  6. 6. SELECT lastname FROM employees ORDER BY lastname
  7. 7. SELECT DISTINCT lastname FROM employees ORDER BY lastname

×