An agent setup recipe
Learn why a join creates extra rows
Trace a small join by matching row pairs, then check why totals or row counts differ from what you expected.
From
You get
What you will get
A prediction exercise, row-pair trace, and explanation of the result’s row meaning
Illustrative example · fictional input
- Example input
- Fictional join review. Orders has one row per order: O1 order_id=10 amount=100; O2 order_id=11 amount=50. Items has one row per order item: I1 order_id=10 item=A; I2 order_id=10 item=B. Join is Orders LEFT JOIN Items ON equal order_id, with no later filter. Desired report: one row per order, but required item presentation is not yet decided. First ask me to predict the joined row count, then wait for my answer. Do not execute or replace the query.
- Example result
- Illustrative result, not a recorded run: first question: How many rows will this LEFT JOIN return? After the learner answers: O1–I1, O1–I2 and O2–NULL give three rows. O1’s 100 repeats because it has two item matches. Ask how items should appear in a one-row-per-order report before changing the query.
The first response asks for a row-count prediction and waits. The trace has O1–I1, O1–I2 and unmatched O2–NULL. Repeated order amounts are explained without calling them new money. No DISTINCT, deletion or query execution is used to force the expected count.
What you need
Use two tiny tables and the exact join condition. This learning exercise makes repeated matches visible before you change a query. You do not need to prepare a full dataset or debug production access. Run any later check only in your normal safe practice environment.
- A ChatGPT account with access to Work on the web. Check your current account allowance; usage depends on your plan.
- Use notes you are allowed to share. Paste them in ChatGPT with the prompt; no plugin, API key, project or custom bot is needed.
- Keep the original material available for the short review below. Missing optional details can stay unknown.
Set it up
- Open ChatGPT in your browser, sign in and select Work if available in your account. Start a new chat for this task.
- Copy the prompt below and paste it into ChatGPT. Add the notes listed under What you need in the same message, in their current form. Keep the default option or change it here first. The assistant will start with your inputs; no separate setup conversation is needed.
- Predict the count, inspect each row pair, and answer the follow-up. Decide the intended row meaning before changing your real query.
Your setup prompt is ready
Copy the ready prompt, or customize it with the settings. Paste it into ChatGPT Work to give it the task rules.
Customize (optional)
Defaults are ready to use. Changes update the prompt here; paste it into your agent to apply them.
Schedule: When I ask.
Use the default or choose the other layout. Both keep the same facts and review checks.
Your choices stay in this browser for this guide. Avoid adding private information.
setup prompt
Highlighted text follows your settings.
Review checks, limits and sources
Not tested by Juicy Agents. The examples are fictional, not recorded agent results.
Check the result
- The first response asks for a row-count prediction and waits.
- The trace has O1–I1, O1–I2 and unmatched O2–NULL.
- Repeated order amounts are explained without calling them new money.
- No DISTINCT, deletion or query execution is used to force the expected count.
Known limits
- Not tested by Juicy Agents. The sample and expected result are fictional; usefulness and time savings have not been measured.
- Small samples can miss relationships and failures in the full data.
- This does not perform query execution, performance tuning or identity matching.
If something goes wrong
- The explanation hides duplicates with DISTINCT: return to the row-pair trace.
- A later WHERE filter changes the result: apply it after the join in the explanation, one row at a time.
Platform sources
- ChatGPT Work on the web (opens in a new tab) · Checked 2026-10-09
- ChatGPT projects (opens in a new tab) · Checked 2026-10-08
- ChatGPT Work access and usage (opens in a new tab) · Checked 2026-10-09
- PostgreSQL 18 table expressions (opens in a new tab) · Checked 2026-10-08
- PostgreSQL 18: table expressions and joins (opens in a new tab) · Checked 2026-10-09
Reviews
No reviews yet
Reviews share personal experience. They are not proof that an agent has passed a test.
Log in to leave a review. You can read and use this recipe without an account.
Explore more
Similar Agents
Review mismatched columns before combining data
Compare small text extracts with an approved data dictionary and prepare a mapping and exception list before anyone changes the files.
View agent dataProfile a data file and prepare a checked cleaning copy
Inspect a CSV or spreadsheet, locate data-quality issues, and apply only the cleaning rules you approve to a separate copy.
View agent dataExplain differences between metric definitions
Compare supplied metric definitions and report settings, then prepare questions for the people who own them.
View agent