What is the difference between GROUP BY and ORDER BY in
Sql?

Answers were Sorted based on User's Feedback



What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / jagadeesh

Groupby: It is a way to sub-total your results,or perform
some other 'aggregate' functions on them.
Orderby: 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.

Is This Answer Correct ?    228 Yes 35 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / ashok

order by use for sorting the result,like ascendin or dcending.

Is This Answer Correct ?    148 Yes 24 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / lalitha

In Group By clause the results are displayed in group wise
manner means it group all the records in a relation together
and then displayed them for a selected set of fields from
the relation and in Order By clause the results are
displayed in some specified order

Is This Answer Correct ?    55 Yes 10 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / haritharavi

Order by clause is used to sort the rows in ascending or
descending order.Group by clause is used to sort/group a
number of rows together so as to apply aggregate functions.
So order by is only to sort the records where as group by
is to sort and find aggregate functions of each group.

Is This Answer Correct ?    32 Yes 5 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / niraj kumar

To sort a result, use an ORDER BY clause.
The most general way to satisfy a GROUP BY clause is to
scan the whole table and create a new temporary table where
all rows from each group are consecutive, and then use this
temporary table to discover groups and apply aggregate
functions (if any).
ORDER BY [col1],[col2],...[coln]; Tells DBMS according to
what columns it should sort the result. If two rows will
hawe the same value in col1 it will try to sort them
according to col2 and so on.
GROUP BY [col1],[col2],...[coln]; Tells DBMS to group
(aggregate) results with same value of column col1. You can
use COUNT(col1), SUM(col1), AVG(col1) with it, if you want
to count all items in group, sum all values or view
average.

Is This Answer Correct ?    24 Yes 7 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / zaid manzoor

The ORDER BY keyword is used to sort the result-set.
The ORDER BY Keyword

The ORDER BY keyword is used to sort the result-set by a specified column.

The ORDER BY keyword sort the records in ascending order by default.

If you want to sort the records in a descending order, you can use the DESC keyword.

SQL ORDER BY Syntax
Aggregate functions often need an added GROUP BY statement.
The GROUP BY Statement
The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns.

Is This Answer Correct ?    19 Yes 5 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / priya

groupby:example:regcode:2 transdate;6/4/2012
trans date 5/5/2012

order by example reg code 2 everybussiness deatail by down
to up

Is This Answer Correct ?    7 Yes 2 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / hareesha k

GROUP BY is used to group values from a column, and, if
necessary, perform calculations on that column. We can use
aggregation functions (e.g. COUNT, SUM, AVG) on the grouped
column.
The result of the GROUP BY is ordered by the column that
grouped.

The ORDER BY clause is used only for ordering(Sorting) the
query results.Asc by default.

Is This Answer Correct ?    3 Yes 1 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / jamsheed

Order by keyword is used to sort the result set in asc & desc order.

Group by keyword is used to group the resultset. It is used to find distinct values also.

Is This Answer Correct ?    2 Yes 1 No

What is the difference between GROUP BY and ORDER BY in Sql?..

Answer / ram

Group by controls the presentation of the rows,Where as
order by controls the presentation of the columns for the
results of the SELECT statement.

Is This Answer Correct ?    58 Yes 68 No

Post New Answer

More MySQL Interview Questions

What you can use regular expression for in mysql?

0 Answers  


What is the difference between having and where clause in mysql? Explain

0 Answers  


Why we use mysql workbench?

0 Answers  


How do I save in mysql?

0 Answers  


Can I use mysql for free?

0 Answers  






What is the purpose of mysql database?

0 Answers  


How can you do the fine tunning?

3 Answers   ACC,


How do I view mysql logs?

0 Answers  


How to get help information from the server?

0 Answers  


How you will show all data from a table.

0 Answers  


Explain MySQL architecture?

1 Answers  


What is database migration in mysql?

0 Answers  


Categories