1SELECT * FROM (
2 SELECT x, (SELECT min(x) FROM my_table t2 WHERE t2.x > t.x) next_x
3 FROM my_table t
4) WHERE x <> next_x - 1;
5/* if my_table contains for x: 1 2 5 6 7 10
6 X NEXT_X
7 2 5
8 7 10
9*/
10-- ⇓ Test it ⇓ (Fiddle source link)