查询其他系中存在比计算机系某一学生年龄小的学生(即年龄小于计算机系年龄最大者的学生)。
为什么用to_days比较年龄报错
//to_days()比较年龄
mysql> select sname,timestampdiff(year,sbirthday,curdate()) from student
-> where to_days(sbirthday)<(select min(to_days(sbirthday)) from student
-> where sdept='计算机系')
-> and sdept<>'计算机系';
Empty set (0.00 sec)
//timestampdiff()比较年龄
mysql> select sname,timestampdiff(year,sbirthday,curdate()) from student
-> where timestampdiff(year,sbirthday,curdate())<(select min(timestampdiff(year,sbirthday,curdate())) from student
-> where sdept='计算机系')
-> and sdept<>'计算机系';