1.在t_reader表中求出读者的平均年龄、最大年龄、最小年龄以及读者的总人数。
SELECT AVG(YEAR(CURDATE())-YEAR(reader_birthday)) AS 平均年龄,
MIN(YEAR(CURDATE())-YEAR(reader_birthday)) AS 最小年龄,
MAX(YEAR(CURDATE())-YEAR(reader_birthday)) AS 最大年龄,
COUNT(reader_id) AS 读者人数
FROM t_reader;

2.在数据表t_reader中查询男女读者的平均年龄，并且按平均年龄的降序排列。
SELECT AVG(YEAR(CURDATE())-YEAR(reader_birthday)) AS 平均年龄,reader_sex        
FROM t_reader
GROUP BY reader_sex
ORDER BY 1 DESC;

3.在数据表t_return_record中统计出每天的还书总量，只显示还书总量大于等于2的记录，并且按还书总量的降序排列。
SELECT COUNT(*) AS 还书总量,return_date      
FROM t_return_record
GROUP BY DAY(return_date)
HAVING COUNT(*)>=2
ORDER BY 1 DESC;

