SORTING RESULTS



MySQL - Sorting Results


Sorting query results is re-arranging the rows returned from a query result set either in ascending or descending order. The DESC keyword is used to sort the query result set in a descending order. The ASC keyword is used to sort the query result set in an ascending order.


Syntax :

SELECT <field1, field2,...>
FROM <table_name>
ORDER BY <field1, field2,...> ASC|DESC

  • We can sort returned result set on any column provided.

  • We can sort the result set on column or columns.

  • ASC or DESC keyword is used to get the result in ascending order or descending order accordingly.Default is ascending order.


    Example :


    SELECT StudentName,StudentClass
    FROM studentinfo
    ORDER BY StudentName,StudentClass ASC
    

    The result will be displayed as follows:
    (As we noticed Names are ordered according to ascending order of alphabets)


    StudentNameStudentclass
    Ajaashitenth
    manjusixth
    Manjushasixth
    Meherishsixth
    Noothansixth
    Sahayanasixth
    Sweekruthasixth


    MySQL TRIGGERS

    MySQL - Triggers

    posted on 2019-11-29 21:44:07 - mysql Tutorials


    Grant_ Revoke Privilege

    MySQL - Grant_ Revoke Privilege

    posted on 2019-11-26 23:15:04 - mysql Tutorials


    MySQL Vs SQL

    MySQL Vs SQL

    posted on 2019-11-25 05:02:26 - mysql Tutorials


    how to use range in golang

    how to use range in golang

    posted on 2022-05-03 08:28:11 - Go lang Tutorials


    find variable type in golang

    find variable type in golang

    posted on 2022-05-03 05:24:55 - Go lang Tutorials


    for loops in golang

    for loops in golang

    posted on 2022-05-03 04:27:40 - Go lang Tutorials