sql中all和any的区别

假如有表:
在这里插入图片描述
select * from score where score>any(select score from score)
表示只要比子查询中其中的一个结果大就行,带有or的成分。
结果为在这里插入图片描述
12大不过任何一个数不满足;13比12大满足;15比12大满足;57比12大满足;
select * from score where score>all(select score from score)
查询为空,因为本表里面没有一个score可以超过本表中的所有score
如果改成
select * from score where score>=all(select score from score)
则结果为在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_31476455/article/details/88165264