title: Insert value in a column conditionally in MySQL
body: <p>I have a table Persons with columns <code>PersonId</code>, <code>FirstName</code>, <code>DeptId</code> and <code>City</code>. The <code>PersonId</code> is a Primary Key.</p>
  <p>By default on first insert, I want the first entry for the <code>DeptId</code> to have a value of <code>3000</code>. And the subsequent entries should always increment on the last value of <code>DeptId</code>.</p>
  <p>Can someone please help me with that in MySQL ?</p>
  <pre><code>1 John 3000 Port Mathurin
  2 James 3001 Port Desny
  
  insert into `Persons` (`PersonID`, `FirstName`, `DeptId`, `City`) VALUES (1, 'Job', select `DeptId` from `Persons` +1, 'Port Mathurin)
  </code></pre>