The content of this page has been automatically translated by AI. If you encounter any problems while reading, you can view the corresponding content in Chinese.

Comparison of Row Value and Array

Last updated: 2024-08-22 16:25:25

Operator
Description
Sample code
Result
IN
Consistent with Subquery IN
select * from t1 where a1 in (2,5,6);
a1
----
2
(1 row)
NOT IN
Consistent with Subquery NOT IN
select * from t1 where a1 not in (2,5,6);
a1
----
1
3
(2 rows)
ANY/SOME
If at least one comparison result is TRUE, it returns TRUE; otherwise, it returns FALSE
select * from t1 where a1 < any(array[1,3]);
a1
----
2
1
(2 rows)
ALL
If all comparison results are TRUE, it returns TRUE; otherwise, it returns FALSE
select * from t1 where a1 < ALL(array[3]);
a1
----
2
1
(2 rows)