How to implement priorities in SQL (postgres)
I'm writing some software that requires storing items in a database, the items need to have a 'priority' so we end up with ID | Name | Priority --------+--------------+---------- 1 | Pear | 4 2 | Apple | 2 3 | Orange | 1 4 | Banana | 3 So now, the top priority fruit is the Orange, then Apple then Banana then Pear. Now, I want to make Pear the number one priority so Pear, Orange, Apple, Banana. The table will look like: ID | Name | Priority --------+--------------+---------- 1 | Pear | 1 2 | Apple | 3 3 | Orange | 2 4 | Banana | 4 Whats the best way to achieve this with PHP and Postgres. Given