|
EMP |
ID |
Name |
Country |
Salary |
1 |
Vijay |
India |
6000 |
2 |
Bill |
USA |
8000 |
3 |
Kris |
France |
3000 |
|
---- Ascending Order
SELECT Country FROM EMP ORDER BY Country ASC
---- Descending Order
SELECT Country FROM EMP ORDER BY Country DESC
---- Specific Order
SELECT *,
CASE Country
WHEN 'France' THEN 1
WHEN 'India' THEN 2
WHEN 'USA' THEN 3
END AS 'MyOwnOrder'
FROM EMP
ORDER BY MySpecificOrder
|
Output |
ID |
Name |
Country |
Salary |
MySpecificOrder |
3 |
Kris |
France |
3000 |
1 |
1 |
Vijay |
India |
6000 |
2 |
2 |
Bill |
USA |
8000 |
3 |
|