Set operations compare rows under SQL's rules for duplicates. Check whether the result represents membership or the number of occurrences.
Worked example
WITH a(n) AS (VALUES (1),(2)), b(n) AS (VALUES (2),(3)) SELECT n FROM a INTERSECT SELECT n FROM b;Result
[
{
"n": 2
}
]Implementation notes
Set operators can remove duplicates even if they were meaningful in the source. Compare aggregation counts when reconciling quantities.
Try it yourself
Repeat a value several times on one side of the comparison.
Open the SQL example →Editorial date November 15, 2026 · Published December 6, 2026