I have a table where I have a row id
that is my primary key. It is a table with ~250 thousand rows. Usually, the id
should be a sequential number. Now I want to find out, if there is a number missing in the sequence of numbers.
Example: The table contains the id
s
1, 2, 4, 6, 7, 8, 9, 10
That means, in the sequence of numbers from 1
to 10
, the numbers 3
and 5
are missing.
How would a MySQL query look like that only returns the missing id
s? Is there a way to increment a counter and compare if that id
exists?