From 8423b3093b017be2c1fff68e2d47a8e498a469dc Mon Sep 17 00:00:00 2001 From: Phil Rzewski Date: Wed, 16 Oct 2024 15:17:36 -0700 Subject: [PATCH] Mention anti join in the Join Tutorial --- docs/tutorials/join.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/tutorials/join.md b/docs/tutorials/join.md index 353586ad5a..9fb5b90f40 100644 --- a/docs/tutorials/join.md +++ b/docs/tutorials/join.md @@ -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