Last-applied sort orders
When you save a table, query, form, or report while the data is sorted, the sort order is automatically saved when you save the object. This is called a last-applied sort order. When you create a sort order, you are actually changing the design of the object.
If you want the last-applied sort order to be automatically applied the next time that you open the object, set the Order By On Load property of the object to Yes. To set this property, perform the following steps while the object is open in Design view.
Press F4 to display the property sheet.
This step is unnecessary if the property sheet is already displayed.
Do one of the following:
If the object is a table or a query, on the General tab of the property sheet, set the Order By On Load property to Yes.
If the object is a form or a report, on the Data tab of the property sheet, set the Order By On Load property to Yes.
Note: You can prevent the last-applied sort order from being applied by setting the Order By On Load property to No.
Default sort orders
Because the last-applied sort order can change whenever someone sorts an object and then saves it, you may want to define a default sort order. A default sort order is part of the design of the object, and does not change when a different sort order is applied.
You can only specify a default sort order for a query or report. Although the default sort order is not overwritten by the current or last-applied sort order, it comes into effect only when the current or last-applied sort order is removed.
Top of Page
Order By Clause
Order by clause is used with Select statement for arranging retrieved data in sorted order. The Order by clause by default sort data in ascending order. To sort data in descending order DESC keyword is used with Order by clause.
Syntax of Order BySELECT column-list|* from table-name order byasc|desc;
Example using Order by
Consider the following Emp table,
The above query will return result in ascending order of the salary.
Example of Order by DESC
Consider the Emp table described above,SELECT * from Emp order by salary DESC;
The above query will return result in descending order of the salary.