Software Testing

k2G9Eo9
RdZQRt6

Popular Posts

ORDER BY

The ORDER BY clause is used to sort the result set by the specified column. 
The ORDER BY keyword sort the record in ascending order by default.
If you want to sort the records in descending order, you can use DESC keyword.
The basic syntax is as follows:
SELECTcolumn1, column2, ... column_n FROM tables ORDER BY Column_Name ASC | DESC
Employee
Emp_idNameSurnameSalaryDept_id
1RajeshKhanna450002
2SnehaGupta550004
3SandeepNehte950001
4KirtiPatil250003
5NileshJadhav450003
6DipeshDas350005
7KailashRane620001
8KavitaDeshpande480003
9SanjayDatt500003
10ShrutiHasan780001

Syntax For SQL:
SELECT Emp_id, Name, Salary, Dept_id
FROM employee ORDER BY Salary DESC
After Execute: 
Emp_idNameSalaryDept_id
3Sandeep950001
10Shruti780001
7Kailash620001
2Sneha550004
9Sanjay500003
8Kavita480003
1Rajesh450002
5Nilesh450003
1Dipesh350002
4Kirti250003

No comments:

Post a Comment