title: How to get MAX from Oracle database
body: <p>I am trying to get the <code>MAX</code> from a database but I am trying two methods, and need to be cleared if both methods are correct or not.</p>
  
  <p><strong>These are my Object types:</strong></p>
  
  <pre><code>Emp_t (eno: number(4), ename: varchar2(15), edept: ref dept_t, salary: number(8,2))
  Dept_t (dno: number(2), dname: varchar2(12), mgr ref emp_t)
  Proj_t (pno: number(4), pname: varchar2(15), pdept ref dept_t, budget: number(10,2))
  </code></pre>
  
  <p><strong>And these are my Tables:</strong></p>
  
  <pre><code>Emp of Emp_t (eno primary key, edept references dept)
  Dept of Dept_t (dno primary key, mgr references emp)
  Proj of Proj_t (pno primary key, pdept references dept)
  </code></pre>
  
  <p>My question is:</p>
  
  <p><strong>Q.) Find the manager’s name who is controlling the project with the largest budget</strong></p>
  
  <p>My first answer is:</p>
  
  <pre><code>SELECT p.pdept.mgr.ename
  FROM proj p
  WHERE p.budget IN (SELECT MAX(p.budget) FROM proj p)
  </code></pre>
  
  <p>And my second answer is:</p>
  
  <pre><code>SELECT p.pdept.mgr.ename, MAX(p.budget)
  FROM proj p
  </code></pre>
  
  <p><strong>I need to know which answer is correct. or both are right. If one is incorrect the reason for that?</strong></p>