Suggestions on side-menu order

The site owner can add new pages via content management system.
Once the page is created a new link automatically appears in the side-menu.
Because this is CMS the side-menu built purely based on the info in the DB. It is not hard coded in any way.
There needs to be a mechanism so that the client can decide what position in the side-menu the new page occupies.
The client also needs to be able modify the order at later time and also delete pages without leaving “gaps” in the data.

Any recommendations on how to implement this
(from the database point of view)?

Would these pages be hierarchical?


What should happen if you remove the cheddar category?

Posting the almost mandatory link to the super-handy ‘Managing Hierarchical Data in MySQL’ article over at


Use an order column
When you insert an item with order x, update all rows > x to x+1
When you delete an item, update all rows > x to x-1
When you move an item up, increase all items between x and x - move to x+1
When you move an item down, decrease all items between x-move and x to x-1

Edit: Or something along those lines, doesn’t look like a hierarchical prob to me, if it is, whole 'nother story.