Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention anti join in the Join Tutorial #5345

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/tutorials/join.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,32 @@ produces
{name:"chris",age:47,likes:"tart",fruit:"apple"}
```

## Anti join

:::tip note
In some databases an anti join is called a _left anti join_.
:::

The join type `anti` allows us to see which fruits are not liked by anyone.
Note that with anti join only values from the left-hand input appear in the
results.

The Zed script `anti-join.zed`:
```mdtest-input anti-join.zed
file fruit.ndjson
| anti join (
file people.ndjson
) on flavor=likes
```
Executing the Zed script:
```mdtest-command
zq -z -I anti-join.zed
```
produces
```mdtest-output
{name:"avocado",color:"green",flavor:"savory"}
```

## Inputs from Pools

As our prior examples all used `zq`, we used the
Expand Down