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

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章