Skip to main contentSkip to solution

Given a table 'EMPLOYEE' as follows:

EMPIDEmpNameDOBDOJSalary
E001Sumit1994-10-102020-05-0550000
E002Ajay1995-08-112021-07-0860000
E003Amit1993-04-142012-04-0970000

Which of the query below will arrange and display the same table in descending order by 'Salary'?

Solution

✅ Correct Option: 3

ORDER BY sorts the rows of a result, and DESC makes the order descending. SELECT * FROM EMPLOYEE ORDER BY Salary DESC; displays all columns of the table, with the highest salary first: E003 (70000), E002 (60000), E001 (50000).


Options 1 and 2: HAVING filters groups and WHERE filters rows. Neither sorts, and DESC is not valid after them.

Option 4: it sorts correctly but shows only the Salary column, not the whole table.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question