title: mysql delete under safe mode
body: <p>I have a table instructor and I want to delete the records that have salary in a range
  An intuitive way is like this: </p>
  
  <pre><code>delete from instructor where salary between 13000 and 15000;
  </code></pre>
  
  <p>However, under safe mode, I cannot delete a record without providing a primary key(ID).</p>
  
  <p>So I write the following sql: </p>
  
  <pre><code>delete from instructor where ID in (select ID from instructor where salary between 13000 and 15000);
  </code></pre>
  
  <p>However, there is an error:</p>
  
  <pre><code>You can't specify target table 'instructor' for update in FROM clause
  </code></pre>
  
  <p>I am confused because when I write</p>
  
  <pre><code>select * from instructor where ID in (select ID from instructor where salary between 13000 and 15000);
  </code></pre>
  
  <p>it does not produce an error.</p>
  
  <p>My question is:</p>
  
  <ol>
  <li>what does this error message really mean and why my code is wrong?</li>
  <li>how to rewrite this code to make it work under safe mode?</li>
  </ol>
  
  <p>Thanks!</p>