Home Sql Mysql-example MySQL ASC



MySQL ASC
Posted on: April 3, 2006 at 12:00 AM
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           |
+----+--------+----------------------+

Related Tags for MySQL ASC:


More Tutorials from this section

Ask Questions?    Discuss: MySQL ASC  

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.