前言

设置了自增id的数据,想查询哪个id被删除了,导致不连续

查询

1
2
3
select id+1 from TableName
where id+1 not in(select id from TableName)
and id+1<>(select max(id)+1 from TableName)