Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • ORDER BY Clause

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 624
    Comment on it

    Sorting the result using Order By clause:

    ORDER BY clause is used to sort the data fetched using select statement either in ascending order or in descending. By default data fetched is sorted in ascending order.

    Syntax:

    Select columnname(s) from tablename ORDER BY columnname [ ASC | DESC ];
    

    Example:

    SELECT City FROM Employee WHERE Name = 'Max' ORDER BY City ASC;
    

    It will return all City of those employee whose name is Max and City will sort in Ascending order.

    SELECT City FROM Employee WHERE Name = 'Max' ORDER BY City DESC;
    

    Similarly it will also return city but in descending order.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: