MySQL obtiene los ID de la tabla que faltan

Tengo esta tabla en MySQL, por ejemplo:

ID | Name 1 | Bob 4 | Adam 6 | Someguy 

Si lo nota, no hay un número de identificación (2, 3 y 5).

¿Cómo puedo escribir una consulta para que MySQL responda solamente los ID que faltan, en este caso: “2,3,5”?

 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) 

Espero que este enlace también ayude a http://www.codediesel.com/mysql/sequence-gaps-in-mysql/

Una consulta más eficiente:

 SELECT (t1.id + 1) as gap_starts_at, (SELECT MIN(t3.id) -1 FROM my_table t3 WHERE t3.id > t1.id) as gap_ends_at FROM my_table t1 WHERE NOT EXISTS (SELECT t2.id FROM my_table t2 WHERE t2.id = t1.id + 1) HAVING gap_ends_at IS NOT NULL 

Las consultas anteriores le darán dos columnas para que pueda intentar obtener los números que faltan en una sola columna

 select start from (SELECT a.id+1 AS start, MIN(b.id) - 1 AS end FROM sequence AS a, sequence AS b WHERE a.id < b.id GROUP BY a.id HAVING start < MIN(b.id)) b UNION select c.end from (SELECT a.id+1 AS start, MIN(b.id) - 1 AS end FROM sequence AS a, sequence AS b WHERE a.id < b.id GROUP BY a.id HAVING start < MIN(b.id)) c order by start; 

Para agregar un poco a la respuesta de Ivan, esta versión muestra números que faltan al principio si 1 no existe:

 SELECT 1 as gap_starts_at, (SELECT MIN(t4.id) -1 FROM testtable t4 WHERE t4.id > 1) as gap_ends_at FROM testtable t5 WHERE NOT EXISTS (SELECT t6.id FROM testtable t6 WHERE t6.id = 1) HAVING gap_ends_at IS NOT NULL limit 1 UNION SELECT (t1.id + 1) as gap_starts_at, (SELECT MIN(t3.id) -1 FROM testtable t3 WHERE t3.id > t1.id) as gap_ends_at FROM testtable t1 WHERE NOT EXISTS (SELECT t2.id FROM testtable t2 WHERE t2.id = t1.id + 1) HAVING gap_ends_at IS NOT NULL;