A function for comparing semantic versions in pure SQL