I just stumbled upon something in ORACLE SQL (not sure if it's in others), that I am curious about. I am asking here as a wiki, since it's hard to try to search symbols in google...
I just found that when checking a value against a set of values you can do
WHERE x = ANY (a, b, c)
WHERE x IN (a, b, c)
ANY (or its synonym
SOME) is a syntax sugar for
EXISTS with a simple correlation:
SELECT * FROM mytable WHERE x <= ANY ( SELECT y FROM othertable )
is the same as:
SELECT * FROM mytable m WHERE EXISTS ( SELECT NULL FROM othertable o WHERE m.x <= o.y )
With the equality condition on a not-nullable field, it becomes similar to
All major databases, including
PostgreSQL, support this keyword.