Register now or log in to join your professional community.
Sorting may be in ascending or descending order, based on Order by clause in query. the requested sorting is done on Server machine once records are fetched.
in oracle ........in sorting assending or desending in ORDER BY CLAUSE.....
it will be sorted in ascending order unless you change it in order by clause
If Order By clause is not imposed, it automatically use the ID or Primary Key for sorting.
We will define it at the end of query but qurey will run from end to start.
The database table has a index cache that uses for accessing the value of any row, when we run the sql query by using the order by clause for index column then it sort asc or desc by user requirment , and also it uses the tempspace for sorting,in case no index column uses then it checks the alphabet or numbers.
It uses SQL Work Areas (a component of PGA) .
When you run the SQL with order by clause it uses the index cache if we use indexed cloumn. In case there is no index on column which defined in order by clause, sorting will happen tempspace/data cache ,