Which SQL statement will retrieve the department number (WORKDEPT) and the highest salary (SALARY) for each department in a table named EMPLOYEE and arrange the result set in ascending order by department?
A . SELECT workdept, salary
FROM employee
GROUP BY workdept
ORDER BY workdept;
B . SELECT workdept, MAX(salary)
FROM employee
ORDER BY workdept
GROUP BY 2;
C . SELECT workdept, MAX(salary)
FROM employee
ORDER BY workdept;
D . SELECT workdept, MAX(salary)
FROM employee
GROUP BY workdept
ORDER BY 1;
Answer: B
Explanation:
Reference: https://www.ibm.com/support/knowledgecenter/SSPT3X_4.2.0/ com.ibm.swg.im.infosphere.biginsights.commsql.doc/doc/r0059224.html