行值与数组的比较

最近更新时间:2019-04-22 11:07:13

操作符 功能描述 示例 结果
IN 与子查询的IN一致 select * from t1 where a1 in (2,5,6); a1
----
2
(1 row)
NOT IN 与子查询的NOT IN一致 select * from t1 where a1 not in (2,5,6); a1
----
1
3
(2 rows)
ANY/SOME 对比结果至少有一个真值,则返回TRUE,否则返回FALSE select * from t1 where a1 < any(array[1,3]); a1
----
2
1
(2 rows)
ALL 对比结果都为TRUE,则返回TRUE,否则返回FALSE select * from t1 where a1 < ALL(array[3]); a1
----
2
1
(2 rows)