Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以仅使用 SQL 从序号中找到最小缺失值?这个例子是这样的。
1 2 3 7 9 10
如何获得“4”的结果 PS:我正在使用 sqlite
我建议这样做:
select min(ID)+1 from t1 where ID+1 not in (select ID from t1)
SQL小提琴
PS 替换t1为您的表的名称。
t1