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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are numeric data types?

555


What is the difference between heap table and temporary table?

622


How internally data stores in MyISAM and INNODB table types?

2090


What is a procedure example?

498


How to change a password for an existing user via mysqladmin?

573






Suppose you have to collect the first name, middle name and the last name of students from the below table. But, you observe that there few missing values either in the first name, middle name and the last name columns. How will you return the first non-null values?

474


What is the data type for file in mysql?

554


How to allow the user "sonia" to connect to the server from localhost using the password "passwd". Login as root. Switch to the mysql db. Give privs. Update privs.

602


How we get sum of column.

509


What is row?

571


How do I insert an image into mysql workbench?

478


What is the use of mysqli_connect in php?

479


Where is mysql data stored linux?

474


What are views in mysql?

521


Is null in mysql?

452