Interview practice question
Finding missing invoice numbers
Data Engineering · SQL · Intermediate
Invoice numbers should be continuous. Find any missing numbers in the sequence.
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Use LEAD to get the next invoice number.
- Where next minus current is greater than 1, there's a gap.
- Report gap start and end.
- Or generate the full series and anti-join.
- Useful for audit checks.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.