Watch Our YouTube Channel
It is currently Mon Jan 22, 2018 10:31 am
 

All times are UTC



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Jun 21, 2016 7:30 am 
Offline

Joined: Fri Nov 13, 2015 3:56 am
Posts: 460
Group by and Order by in SQL
Group By:
Group By will aggregate records by the specified columns which allows you to perform aggregation functions on non-grouped columns (such as SUM, COUNT, AVG, etc).

A group by performs a grouping operation.Group by is applied based of aggregation.

Group By allows you to take your result set, group it into logical groups and then run aggregate queries on those groups. You could for instance select all employees, group them by their workplace location and calculate the average salary of all employees of each workplace location.

It is a way to sub-total your results,or perform some other 'aggregate' functions on them.

Order By:
Order By alters the order in which items are returned. an order by sorts.

Order By allows you to sort the result set according to different criteria, such as first sort by name from a-z, then sort by the price highest to lowest.

Order by uses the sorting algorithms however both uses indexing applied on table.

It is a simply a way to sort your results. It doesn't affect what shows up in your result set,only what order it is displayed.

_________________
Learn Web Development | Latest Technology News |Motivational Quotes


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 04, 2017 5:42 am 
Offline

Joined: Wed Jul 01, 2015 11:28 am
Posts: 172
Location: Bangalore
The difference is exactly what the name implies: a group by performs a grouping operation, and an order by sorts

_________________
Digital Marketing Company in India| Web Design Company in India | SEO Services in India


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron