1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > SQL some any all

SQL some any all

时间:2022-11-03 04:40:25

相关推荐

SQL some any all

回顾一下some any all 用法

userinfo表里面有100条数据,其中一个用户名为qixuejia.

1.some,any用法一样(不知道有没有其他的不同)

select count(*) from userinfo

where 'qixuejia' <> some(select userid from userinfo)

where 条件成立 该条语句返回100.

2.all

select count(*) from userinfo

where 'qixuejia' <> all(select userid from userinfo)

该where语句判断qixuejia不等于所有的userid,返回否.

所以该语句返回0

3.select count(*) from userinfo

where 'qixuejia'in (select userid from userinfo)

返回100

4.select count(*) from userinfo

where userid='qixuejia'

返回1

5.select count(*) from userinfo

where 'qixuejia' not in (select userid from userinfo)

返回0

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。