title: Counting value changes in a table column
body: <p>Consider a sorted table (according to id). How to count number of changes of the values in  column 'value'? In the following example, the number of changes is 3 (10 to 20, 20 to 10, 10 to 30). Thx</p>
  
  <pre>
  id    value
   1      10
   2      10
   3      20
   4      20
   5      10
   6      30
   7      30
  </pre>