Skip to main content

List the details of the emps in asc order of the Dptnos and desc of Jobs?

Answer:

select * from emp order by deptno asc,job desc;

Comments

  1. Good Quality Post! Looking forward to reading your other articles, Keep it up!click here for josaa counselling 2020

    ReplyDelete
  2. but the out put is not as job desc order

    ReplyDelete

Post a Comment

Popular Posts

How to find out Max Salary from each department

You can find maximum salary for each department by grouping all records by DeptId and then using MAX() function to calculate maximum salary in each group or each department. SQL Query: SELECT DeptID, MAX(Salary) FROM Employee  GROUP BY DeptID. This questions become more interesting if Interviewer will ask you to print department name instead of department id, in that case you need to join Employee table with Department using foreign key DeptID, make sure you do LEFT or RIGHT OUTER JOIN to include departments without any employee as well.  Here is the query