在SQL的嵌套查询中,如何区分谓词ANY和ALL,请用实例进行说明。

麻烦举一下例子呀。... 麻烦举一下例子呀。 展开
 我来答
百度网友024827e
推荐于2018-04-13 · TA获得超过1657个赞
知道大有可为答主
回答量:1117
采纳率:93%
帮助的人:382万
展开全部
any 是任意一个
all 是所有

比如
select * from student where 班级='01' and age > all (select age from student where 班级='02');

就是说,查询出01班中,年龄大于 02班所有人 的 同学
相当于
select * from student where 班级='01' and age > (select max(age) from student where 班级='02');


select * from student where 班级='01' and age > any (select age from student where 班级='02');

就是说,查询出01班中,年龄大于 02班任意一个 的 同学
相当于
select * from student where 班级='01' and age > (select min(age) from student where 班级='02');
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式