v.21.9New Feature

Add Support for INTERSECT, EXCEPT, ANY, ALL Operators

Add support for INTERSECT, EXCEPT, ANY, ALL operators. #24757 (Kirill Ershov). (Kseniia Sumarokova).
Added support for the SQL set operations INTERSECT and EXCEPT, as well as modifiers ANY and ALL in ClickHouse queries.

Why it matters

This feature extends ClickHouse's SQL capabilities by enabling users to perform set operations that return the common or distinct elements between query results. Support for ANY and ALL modifiers allows more precise control over how duplicates are handled in these operations, improving the expressiveness and compatibility of ClickHouse with standard SQL.

How to use it

Users can now write queries using the INTERSECT and EXCEPT operators directly in their SQL statements. Additionally, they can specify ANY or ALL modifiers after these operators to control duplicate row handling, for example:

SELECT  FROM table1 INTERSECT ALL SELECT  FROM table2

This feature requires no additional configuration and is available once the ClickHouse version including this update is installed.