Learn DBMS and MySQL

Our tutorial provides basic and advance concepts of database management and MySQL commands with detailed examples

DBMS Introduction
MySQL Database
MySQL Tables
MySQL Queries
MySQL Clauses
MySQL Conditions
MySQL Keys

MySQL ORDER BY

The MYSQL ORDER BY Clause is used to sort the records in ascending or descending order.

Syntax:

 SELECT expressions  
 FROM tables  
 [WHERE conditions]  
 ORDER BY expression [ ASC | DESC ];  

expressions: It specifies the columns that you want to retrieve.

tables: It specifies the tables, from where you want to retrieve records. There must be at least one table listed in the FROM clause.

WHERE conditions: It is optional. It specifies conditions that must be fulfilled for the records to be selected.

ASC: It is optional. It sorts the result set in ascending order by expression (default, if no modifier is provider).

DESC: It is also optional. It sorts the result set in descending order by expression.

Let's move on to GROUP BY keyword in MySQL


Share this page on :