[sql] Finding the next available id in MySQL