Skip to main content
Admissions guidance, study banks, and career tools โ€” get started on Shalyam

Gaps in Sequential IDs

Return the missing ids in a table whose ids should run from the minimum to the maximum without gaps. Return them ordered ascending in a column named missing_id.

Table schema

Tickets(id INT PRIMARY KEY)

Sample data

id
1
2
4
7

Discussion

No discussions yet.

Rewards ยท v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.