ORDER BY
Used to sort records, and by default it will sort records in AESC order
Table : Salary
Emp_id | Emp_name | Emp_reg | Emp_salary |
---|---|---|---|
01 | chandan | E_01 | 25000 |
02 | adhiraj | E_02 | 30000 |
03 | raghu | E_03 | 35000 |
04 | Alax | E_04 | 40000 |
Suppose you need to find the Emp_name which have Emp_reg = "R01" & Emp_id = 1
Select Emp_name, Emp_salary from Salary ORDERY BY Emp_salary RESULT:Emp_name | Emp_salary |
---|---|
chandan | 25000 |
adhiraj | 30000 |
raghu | 35000 |
Alax | 40000 |
Consider above table again & suppose you need to short the record in desc order
Select Emp_name, Emp_salary from Salary ORDERY BY Emp_salary DESC RESULT:
Emp_name | Emp_salary |
---|---|
Alax | 40000 |
raghu | 35000 |
adhiraj | 30000 |
chandan | 25000 |
No comments:
Post a Comment