SELECT AVG(a) FROM ( SELECT a, @a:=@a+1 AS b FROM t1,(SELECT @a:=0) t2 ORDER BY a ) AS t WHERE b BETWEEN @a/2 AND @a/2+1;
MySQL 还可以使用子查询和变量(但注意:窗口函数仅适用于 MySQL 8.0 及以上版本),老版本可以使用变量和会话变量方式。