The ORDER BY clause is used to fetch the data in ascending or descending order.
column1,column2 are the columns of the table.
emp_id | name | city | salary |
---|---|---|---|
104 | Rahul | Bangalore | 60000 |
101 | John | California | 50000 |
103 | Harry | Delhi | 80000 |
105 | Sakil | Delhi | 90000 |
102 | Tom | Mumbai | 40000 |
Sorts the city in ascending order.
emp_id | name | city | salary |
---|---|---|---|
102 | Tom | Mumbai | 40000 |
103 | Harry | Delhi | 80000 |
105 | Sakil | Delhi | 90000 |
101 | John | California | 50000 |
104 | Rahul | Bangalore | 60000 |
emp_id | name | city | salary |
---|---|---|---|
104 | Rahul | Bangalore | 60000 |
101 | John | California | 50000 |
103 | Harry | Delhi | 80000 |
105 | Sakil | Delhi | 90000 |
102 | Tom | Mumbai | 40000 |