Home Sql Mysql-example Mysql ASC Order

Related Tutorials


 
 

Share on Google+Share on Google+

Mysql ASC Order

Advertisement
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 |
+------+---------+
Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 20, 2009

Related Tutorials

Discuss: Mysql ASC Order  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com