你的位置:首页 > 软件开发 > 数据库 > msyql中子查询IN,EXISTS,ANY,ALL,SOME,UNION介绍

msyql中子查询IN,EXISTS,ANY,ALL,SOME,UNION介绍

发布时间:2015-08-08 01:00:17
1.ANY关键字假设any内部的查询语句返回的结果个数是三个,如:result1,result2,result3,那么,select ...from ... where a > any(...);->select ...from ... where a > re ...

1.ANY关键字

假设any内部的查询语句返回的结果个数是三个,如:result1,result2,result3,那么,

select ...from ... where a > any(...);

->

select ...from ... where a > result1 or a > result2 or a > result3;

2.ALL关键字

ALL关键字与any关键字类似,只不过上面的or改成and。即:

select ...from ... where a > all(...);

->

select ...from ... where a > result1 and a > result2 and a > result3;

3.SOME关键字

some关键字和any关键字是一样的功能。所以:

select ...from ... where a > some(...);

->

select ...from ... where a > result1 or a > result2 or a > result3;

4.IN关键字

IN运算符用于WHERE表达式中,以列表项的形式支持多个选择,语法如下:

  WHERE column IN (value1,value2,...)

原标题:msyql中子查询IN,EXISTS,ANY,ALL,SOME,UNION介绍

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录