title: Find consecutive rows from n with SQLite
body: <p>I have this table with values:</p>
  
  <pre><code>val  
  1
  2
  3
  7
  8
  9
  </code></pre>
  
  <p>The table has also an id column, not relevant right now.</p>
  
  <p>I want to insert one value, but the rule is there can't be any repeated values. Let's say I insert a new 2, the current 2 should become 3, and so on, up to the value 3, which will turn into 4. In this case, the values 7, 8 and 9 don't need to be 'moved'.</p>
  
  <p>I'm working with <b>SQLite</b>. The insert or update part can be done in a separate query, after the desired new value holder is 'moved'.</p>
  
  <p>So far I was doing this with:</p>
  
  <pre><code>//being n my new value.
  UPDATE values SET val = val+1 WHERE val &gt;= n 
  </code></pre>
  
  <p>But this would also modify 7,8 and 9, which don't need to be modified.</p>
  
  <p>Any thoughts about how to solve this part of the issue? Limiting the update to only the consecutive values? </p>
  
  <p>A better way of doing the whole insert/update in one query would be also very appreciated.</p>