title: How to find out 2nd highest salary of employees?
body: <p>Created table named <code>geosalary</code> with columns <code>name</code>, <code>id</code>, and <code>salary</code>:</p>
  
  <pre><code>name   id  salary  
  patrik  2  1000  
  frank   2  2000  
  chinmon 3  1300  
  paddy   3  1700  
  </code></pre>
  
  <p>I tried this below code to find 2nd highest salary:</p>
  
  <pre><code>SELECT salary
  FROM (SELECT salary, DENSE_RANK() OVER(ORDER BY SALARY) AS DENSE_RANK FROM geosalary)
  WHERE DENSE_RANK = 2;
  </code></pre>
  
  <p>However, getting this error message:</p>
  
  <pre><code>ERROR: subquery in FROM must have an alias  
  SQL state: 42601  
  Hint: For example, FROM (SELECT ...) [AS] foo.  
  Character: 24  
  </code></pre>
  
  <p>What's wrong with my code?</p>