home / skills / bdambrosio / cognitive_workbench / test-json-sql-join
This skill helps you test SQL inner joins by generating in memory datasets and validating expected joined results.
npx playbooks add skill bdambrosio/cognitive_workbench --skill test-json-sql-joinReview the files below or copy the command above to add this skill to your agents.
---
name: test-json-sql-join
description: Tests join primitive (INNER JOIN)
manual_only: true
---
# Test Join Primitive
**Self-contained:** Creates test data internally
**Input:**
- Creates $papers: A, B, C, D
- Creates $authors: A (Alice), B (Bob), E (Eve)
**Operation:** Inner join on id field
**Expected Output:** $joined collection with 2 items (A and B have matches)
- Paper A + Author Alice
- Paper B + Author Bob
This skill tests an INNER JOIN primitive by creating self-contained sample data and asserting the expected join results. It validates that only records with matching id values from two collections are returned. The test is focused, deterministic, and requires no external dependencies.
The skill constructs two in-memory collections: papers and authors. Papers include items A, B, C, D and authors include A (Alice), B (Bob), E (Eve). It performs an inner join on the id field and produces a joined collection containing only records with matching ids (A and B). The output is asserted to contain exactly two joined items combining paper and author data.
What does the test assert?
It asserts that the inner join returns exactly two joined items combining paper A with author Alice and paper B with author Bob.
Why are papers C, D and author E excluded?
They do not have matching id values across the two collections, so an INNER JOIN excludes them by design.