Finding if a sequence has gaps is easy, finding the exact list of missing numbers is a little involved. The following query lists the missing numbers from a given auto-increment column.
``` SELECT a.id+1 AS start, MIN(b.id) - 1 AS end FROM testtable AS a, testtable AS b WHERE a.id < b.id GROUP BY a.id HAVING start < MIN(b.id) ```