bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!

Order By & Group By

 

Order By:

It is used to sort the data in the ascending or descending order. It sorts the data in ascending order by default. To sort the data in descending order we use DESC keyword.

Syntax:

SELECT column1, column2….

FROM table_name

ORDER BY column1 ASC/DESC, column2 ASC/DESC;

Example:

Sort all the students in the descending order by the “marks” column.

SELECT Name

FROM Student_details

ORDER BY Roll_no DESC;

 

Group By:

It is used to arrange similar data into group. The GROUP BY clause follows the WHERE clause and comes before the ORDER BY clause.

Syntax:

SELECT column1, column 2…

FROM table_name

WHERE [condition]

GROUP BY column1, column2

ORDER BY column1, column2;

Example:

If we want to know the total marks of each student, then GROUP BY is used as follows:

SELECT Name, Sum(marks)

FROM Student_details

GROUP BY Name;

"0 Responses on Order By & Group By"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

top

Sales Offer

  • To avail this offer, enroll before 05th December 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free Order By & Group By.