Informatics Practices
What is the use of ORDER BY clause ?
SQL Queries
1 Like
Answer
In SQL, the ORDER BY
clause is used to sort the rows of the result set produced by a SELECT
statement. We can specify one or more columns in the ORDER BY
clause to sort the result set either in ascending (default) or descending order.
Answered By
1 Like
Related Questions
Assertion. Both WHERE and HAVING clauses are used for specifying conditions.
Reason. The WHERE condition is applicable on individual rows and HAVING condition is applicable on a group of rows.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Anjali writes the following commands with respect to a table employee having fields, empno, name, department, commission :
Command1:
Select count(*) from employee;
Command2:Select count(commission) from employee;
She gets the output as 4 for the first command but gets an output 3 for the second command. Explain the output with justification.
What is the default sort order of ORDER BY clause ?
Write an example query that sorts on three columns.