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

 

 

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