sql any all

teacher表

 

 

select t.t_no,t.t_name,t.t_age
from teacher t
where t.t_age > any (select t_age from teacher where t_age>29);

>any的意思是大于任意一条即可,所以结果等价于   >30,即只有59的符合条件

 

 

select t.t_no,t.t_name,t.t_age
from teacher t
where t.t_age < all (select t_age from teacher where t_age>29);

<all 的意思是,小于所有的,即小于里边最小的那个,即<30

 

 

posted @ 2021-01-24 18:38  一年变大牛  阅读(94)  评论(0编辑  收藏  举报