title: first/ last vs min/max. ORACLE. SQL
body: <p>Here is the query and the result of the query:</p>
  
  <pre><code>SELECT empno,
         deptno,
         sal,
         MIN(sal) KEEP (DENSE_RANK FIRST ORDER BY sal) OVER (PARTITION BY deptno) "Lowest",
         MAX(sal) KEEP (DENSE_RANK LAST ORDER BY sal) OVER (PARTITION BY deptno) "Highest"
  FROM   emp
  ORDER BY deptno, sal;
  
       EMPNO     DEPTNO        SAL     Lowest    Highest
  ---------- ---------- ---------- ---------- ----------
        7934         10       1300       1300       5000
        7782         10       2450       1300       5000
        7839         10       5000       1300       5000
        7369         20        800        800       3000
        7876         20       1100        800       3000
        7566         20       2975        800       3000
        7788         20       3000        800       3000
        7902         20       3000        800       3000
        7900         30        950        950       2850
        7654         30       1250        950       2850
        7521         30       1250        950       2850
        7844         30       1500        950       2850
        7499         30       1600        950       2850
        7698         30       2850        950       2850
  
  SQL&gt;
  </code></pre>
  
  <p>Would it return the same result <strong>without</strong> KEEP statement? WHy or why not?</p>
  
  <p>P.S. I would have checked it myself but do not have a database access on the current machine.</p>