title: Delete duplicate records using rownum in sql
body: <p>Please help me to know delete records based on the rownum where even id is duplicate it won't happen but if it is the case.</p>
  
  <pre><code>select rownum,a.* from a;
  
      ROWNUM         ID NAME
  ---------- ---------- ----------
           1          1 leo_1
           2          2 leo_2
           3          3 leo_3
           4          1 leo_1
           5          2 leo_2
           6          3 leo_3
  </code></pre>
  
  <p>Query Tried but deletes all 6 rows.</p>
  
  <pre><code>DELETE FROM a
  WHERE rownum not in
  (SELECT MIN(rownum)
  FROM a
  GROUP BY name);
  </code></pre>
  
  <p>But this Query gives correct result:</p>
  
  <pre><code>SELECT MIN(rownum)
  FROM a
  GROUP BY name
  
      ROWNUM
  ----------
           1
           2
           3
  </code></pre>
  
  <p>Expected Result :</p>
  
  <pre><code>    ROWNUM         ID NAME
  ---------- ---------- ----------
           4          1 leo_1
           5          2 leo_2
           6          3 leo_3
  </code></pre>