You need to create a query that issues dname, ename, the string 'boss' if the employee’s salary is equal to the maximum in this department. Already there is a ready code, but it needs a little remake:
SELECT * FROM (SELECT d.dname, e.ename, DENSE_RANK() OVER (PARTITION BY e.deptno ORDER BY e.sal DESC) boss FROM emp e, dept d WHERE e.deptno = d.deptno) WHERE boss = 1; It is required to display all records where the value of "boss" will or will not appear in a separate field. But my query displays the bosses immediately. All head already broke. I hope for advice more experienced sql-programmers.
boss, if not the maximum - do we print an empty string ornull? I correctly understood the task? - Zufir