> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# ds_theta_a_not_b

> Returns a serialized Theta sketch whose distinct count estimates |A\B|, the elements in sketch A that are not in sketch B.

Scalar set difference of two serialized Apache DataSketches Theta sketches.
Returns a serialized compact sketch whose distinct count estimates
`|A \ B|` (elements in A but not in B). Returns `NULL` if either input is `NULL`.

## Syntax

```Haskell theme={null}
VARBINARY ds_theta_a_not_b(sketch_a, sketch_b)
```

* `sketch_a`, `sketch_b`: `VARBINARY` compact theta sketches.

## Examples

```SQL theme={null}
-- Distinct users in cohort A who did not appear in cohort B.
SELECT ds_theta_estimate(ds_theta_a_not_b(a.sk, b.sk))
FROM cohort_a a JOIN cohort_b b USING (day);
```

## Keywords

DS\_THETA\_A\_NOT\_B, DS\_THETA\_UNION, DS\_THETA\_INTERSECT


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.