Multiple choice technology programming languages

Consider an emp table having columns empno, empname, salary Which of the following queries sort emp table by empname and then by salary in descending order

  1. select empno, empname, salary from emp order by empname, salary desc;

  2. select empno from emp sort by empname, sal in desc;

  3. select empno, empname, salary from emp sort in empname, salary desc;

  4. select # from emp sort by empname and salary in desc;

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The correct query is 'SELECT empno, empname, salary FROM emp ORDER BY empname, salary DESC'. This sorts by empname first (ascending by default), then by salary in descending order within each empname group. Options B and C incorrectly use 'SORT BY' instead of 'ORDER BY' (SQL uses ORDER BY). Option D has syntax errors with '#', 'sort by', and 'in desc' - the correct syntax is ORDER BY with DESC keyword.