add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE IF NOT EXISTS `article` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`order` INT(11),
PRIMARY KEY (`id`)
);

INSERT INTO `article`
VALUES
(1, 0), (2, 1), (3, 2), (4, 3), (5, 4),
(6, 5), (7, 6), (8, 7), (9, 8), (10, 9);
SELECT *
FROM `article`;

UPDATE `article`
SET `order` = IF(`id` = 3, 6, `order` - 1)
WHERE `order` BETWEEN 2 AND 6;

SELECT *
FROM `article`
ORDER BY `order`;
id order
1 0
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9
id order
1 0
2 1
4 2
5 3
6 4
7 5
3 6
8 7
9 8
10 9