I have a mysql table ( tbl_test
) that has a unique ID, string and an int order.
ID | Nome | Ordem
1 | name1 | 1
2 | name2 | 4
3 | name3 | 3
4 | name4 | 5
5 | name5 | 2
I would like to know if it is possible to insert a new new element with order 3 to pass all elements from the old three up one. In other words, when entering 6 | name6 | 3
the table would look like this:
ID | Nome | Ordem
1 | name1 | 1
2 | name2 | 5
3 | name3 | 4
4 | name4 | 6
5 | name5 | 2
6 | name6 | 3