数据库里any 和 all 的区别
生活随笔
收集整理的這篇文章主要介紹了
数据库里any 和 all 的区别
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
any 是任意一個
all 是所有
比如
select * from student where 班級='01' and age > all (select age from student where 班級='02');
就是說,查詢出01班中,年齡大于 02班所有人 的 同學
相當于
1
select * from student where 班級='01' and age > (select max(age) from student where 班級='02');
而
1
select * from student where 班級='01' and age > any (select age from student where 班級='02');
就是說,查詢出01班中,年齡大于 02班任意一個 的 同學
相當于
1
select * from student where 班級='01' and age > (select min(age) from student where 班級='02');
轉載于:https://www.cnblogs.com/zxl89/p/5977342.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的数据库里any 和 all 的区别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 建立触发器
- 下一篇: webform(九)——JQuery基础