How to use Sql statement to find the minimum available id
This article mainly introduces "how to use the Sql sentence to find the minimum available id". In the daily operation, I believe that many people have doubts about how to use the Sql sentence to find the minimum available id. The editor consulted all kinds of materials and sorted out a simple and easy-to-use operation method. I hope it will be helpful for everyone to answer the doubt of "how to use the Sql sentence to find the minimum available id". Next, please follow the editor to study!
Select id from test a where not exists (select 1 from test where id=a.id+1) order by id
Disadvantages, do not start from 1.
At this point, the study on "how to use Sql sentences to find the minimum available id" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!