title: How to delete tuple as the salary less than the average?
body: <p>Delete all instructors whose salary is less than the average salary of instructors</p>
  
  <p>if i use the MySQL below:</p>
  
  <pre><code>delete from instructor
  where salary&lt; (select avg (salary) from instructor);
  </code></pre>
  
  <p>If we use the SQL above, it will lead to a problem: as we delete tuples from deposit, the average salary changes</p>
  
  <p>So How to implements this?</p>
  
  <p>I have an idea that </p>
  
  <ol>
  <li>First, compute avg salary and find all tuples to delete</li>
  <li>Next, delete all tuples found above (without 
           recomputing avg or retesting the tuples) </li>
  </ol>
  
  <p>but when i implements this:
  it always shows error in the Workbench with MySQL</p>
  
  <pre><code>delete 
  from (select*
      from instructor
      where salary &lt; (select avg(salary) from instructor)) as A
  </code></pre>
  
  <p>Can anyone help me to solve it?</p>