题解 | #考试分数(四)#
考试分数(四)
https://www.nowcoder.com/practice/502fb6e2b1ad4e56aa2e0dd90c6edf3c
SELECT job, FLOOR((COUNT(1) + 1) / 2) start, FLOOR(COUNT(1) / 2 + 1) end FROM grade GROUP BY job ORDER BY job -- 3个数 start = 2,end = 2 -- 4个数 statr = 2,end = 3 -- start = (n + 1) / 2 -- end = n / 2 + 1
除法向下取整
start = (n + 1) / 2
end = n / 2 + 1