Mysql ASC Order

Mysql ASC Order is used to sort the result set by ascending or descending order. The Order by CLAUSE sort the result by specified column.

Mysql ASC Order

Mysql ASC Order

     

Mysql ASC Order is used to sort the result set by ascending or descending order. The Order by CLAUSE sort the result by specified column.

Understand with Example

The Section of this Tutorial illustrate an example from 'Mysql Asc Order'. To understand the example we create a table 'Stu'. The create table keyword is used in creating a table 'Stu'.

The section of this tutorial illustrate an example from 

 

 

 

Create Table Stu

Create Table Stu(Id int,Name Varchar(15));

Insert values into Stu

Now we insert the values using insert into keyword that add the records or rows into table 'Stu'.

Insert Into Stu values(1,'Ajay');
Insert Into Stu values(2,'Bhanu');
Insert Into Stu values(4,'Rakesh');
Insert Into Stu values(5,'Santosh');
Insert Into Stu values(3,'Komal');

Stu

+------+---------+
| Id   | Name    |
+------+---------+
| 1    | Ajay    |
| 2    | Bhanu   |
| 4    | Rakesh  |
| 5    | Santosh |
| 3    | Komal   |
+------+---------+

Query

The Query given below sort the records from 'stu' in ascending order.

Select * from Stu order by id ASC;

Result

+------+---------+
| Id   | Name    |
+------+---------+
| 1    | Ajay    |
| 2    | Bhanu   |
| 3    | Komal   |
| 4    | Rakesh  |
| 5    | Santosh |
+------+---------+