MySQL ASC

Executing select query with order by clause returns the rows in the order of column name specified with the order by clause.

MySQL ASC

     

This example illustrates how to display data of the table in ascending order.

Executing select query with order by clause returns the rows in the order of column name specified with the order by clause. By default, the data is returned in ascending order. But you can explicitly mention the order of the result by ASC keyword. ASC determines that the results will be shown in ascending order. If you want the order in descending order then use DESC keyword.

In this example, select query displays data in ascending order of name.

 

 

 

 

Query
SELECT * FROM employee ORDER BY name ASC;
Output
+----+--------+----------------------+
| id | name   | designation          |
+----+--------+----------------------+
| 1  | Ajay   | programmer           |
| 3  | Kamal  | sr. graphic designer |
| 7  | Karan  | programmer           |
| 5  | Nitin  | content writer       |
| 8  | Rajesh | graphic designer     |
| 4  | Rajiv  | graphic designer     |
| 6  | Sachin | programmer           |
| 2  | Vinay  | programmer           |
+----+--------+----------------------+

Advertisements

Ads
Share on Google+Share on Google+

MySQL ASC

Posted on: April 3, 2006 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: MySQL ASC  

Post your Comment


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

Ads

 

Ads