MDL-45390 gradebook: sql tidy up and version alignment.