
SQL 中some和all的区别
selects#fromswheres#=some(selects#fromscwherec#='c2')selects#fromswheres#=<>all(selec...
select s#
from s
where s#=some(select s#
from sc
where c#='c2')
select s#
from s
where s#=<>all(select s#
from sc
where c#='c2')
这里面的some all的区别是什么 具体说一下 其中s是学生表 sc是成绩表 s#学生学好 c#课程号 展开
from s
where s#=some(select s#
from sc
where c#='c2')
select s#
from s
where s#=<>all(select s#
from sc
where c#='c2')
这里面的some all的区别是什么 具体说一下 其中s是学生表 sc是成绩表 s#学生学好 c#课程号 展开
3个回答
展开全部
--All:对所有数据都满足条件,整个条件才成立,例如:5大于所有返回的id
select *
from #A
where 5>All(select id from #A)
go
--Any:只要有一条数据满足条件,整个条件成立,例如:3大于1,2
select *
from #A
where 3>any(select id from #A)
select *
from #A
where 5>All(select id from #A)
go
--Any:只要有一条数据满足条件,整个条件成立,例如:3大于1,2
select *
from #A
where 3>any(select id from #A)
展开全部
停课不停学 some 和any的特殊用法
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询