title: Oracle Analytic function for min value in grouping
body: <p>I'm new to working with analytic functions. </p>
  
  <pre>
  DEPT EMP   SALARY
  ---- ----- ------
    10 MARY  100000
    10 JOHN  200000
    10 SCOTT 300000
    20 BOB   100000
    20 BETTY 200000
    30 ALAN  100000
    30 TOM   200000
    30 JEFF  300000
  </pre>
  
  <p>I want the department and employee with minimum salary.</p>
  
  <p>Results should look like:</p>
  
  <pre>
  DEPT EMP   SALARY
  ---- ----- ------
    10 MARY  100000
    20 BOB   100000
    30 ALAN  100000
  </pre>
  
  <p>EDIT: Here's the SQL I have (but of course, it doesn't work as it wants staff in the group by clause as well):</p>
  
  <pre>
  SELECT dept, 
    emp,
    MIN(salary) KEEP (DENSE_RANK FIRST ORDER BY salary)
  FROM mytable
  GROUP BY dept
  </pre>