http://qs321.pair.com?node_id=438483


in reply to reordering a stack with little effort

Instead of this system of using fractional question numbers, I would consider giving the questions a simple incrementing integer for identification, and having the order of the questions be stored by other means. A simple system for maintaining order might be a linked list. A table to hold this information could look something like this:

 id | next
----+------
  1 |    2
  2 |    3
  3 |    4
  4 | NULL

Then, if someone asks you to insert a question between 2 and 3, you would simply have to change it like so:

 id | next
----+------
  1 |    2
  2 |    5
  5 |    3
  3 |    4
  4 | NULL