通过获取当前时间的年月日,然后获取年份,再过获取数据中的年月日获取年份。 select year(CURDATE())-year(sbirthday) from student; 这种方式获取的年龄并不是很准确。