Check out example codes for "order by sql". It will help you in understanding the concepts better.

Code Example 1

//this_for_descending_order.. 
 SELECT * FROM TableName ORDER BY columnName DESC;
 // this_for_ascending_order..
SELECT * FROM TableName ORDER BY columnName ASC;

Code Example 2

//this_for_descending_order.. 
 SELECT * FROM TableName ORDER BY columnName DESC;
 // this_for_ascending_order..
SELECT * FROM TableName ORDER BY columnName ASC;

Code Example 3

The SQL ORDER BY Keyword:
--------------------------------
The ORDER BY keyword is used to sort the result-set in ascending or descending order.

The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.

ORDER BY Syntax:
--------------------------------
SELECT column1, column2, ...

FROM table_name

ORDER BY column1, column2, ... ASC|DESC;

Code Example 4

SELECT q.* 
    FROM (SELECT TOP 3 * 
              FROM table 
              ORDER BY id DESC) q
    ORDER BY q.id ASC

Code Example 5

SELECT * FROM table_name ORDER BY column_name ASC|DESC

/*table_name: name of the table.
column_name: name of the column ;data is needed to be arranged.
ASC: to sort the data in ascending order.
DESC: to sort the data in descending order.
| : use either ASC or DESC to sort in ascending or descending order
*/

Learn ReactJs, React Native from akashmittal.com