Home Sql Mysql-example Mysql ASC Order



Mysql ASC Order
Posted on: January 20, 2009 at 12:00 AM
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 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 |
+------+---------+

Related Tags for Mysql ASC Order:
sqlmysqlcsortsedcolumnordersetifietociedesuseulresultpeceinasmclauseclesspecendumnssuspsocolmyisascendingrtscessrdthendinglumndolo


More Tutorials from this section

Ask Questions?    Discuss: Mysql ASC Order  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.