Node.js MySQL ORDER BY

Node.js MySQL ORDER BY is used to in conjunction with SELECT FROM Query to sort the records in ascending or descending order with respect to a column.

Node.js MySQL ORDER BY

By default, Node.js MySQL ORDER BY results in an ascending order of elements. For descending order of records, DESC keyword should be used.

 

Example to ORDER records in Ascending Order w.r.t. column of NUMERIC data type

Run the above Node.js MySQL ORDER BY example program.
The records are sorted in ascending order with respect to marks column.

 

Example to ORDER records in Ascending Order w.r.t. column of TEXT data type

Run the above Node.js MySQL ORDER BY example program.
The records are sorted in ascending order with respect to name column.

 

Example to ORDER records in Descending Order

Run the above Node.js MySQL ORDER BY example program.
The records are sorted in descending order with respect to name column.

Conclusion :

In this Node.js TutorialNode.js MySQL Module -Node.js MySQL ORDER BY – we have learnt to sort the records in ascending or descending order w.r.t. a column with example Node.js MySQL programs.