Module 12 Activity
Scenario
A colleague has prepared a table for an AI assistant to retrieve from and asks you to review it before it goes live. Everything you approve here becomes something the assistant can say to a user - and everything you miss becomes something it can say wrongly.
Task
- Build the retrieval table: one row per order, with a
doc_id, self-containedcontent, and the
metadata needed to filter and cite.
- Check the grain. Confirm the number of rows in equals the number of rows out.
- Check that
doc_idis unique, and that it is derived from a stable source key rather than a row number. - Read the content of order 501 aloud. Could a reader tell what it describes with no other context?
- Find the rows whose customer has no recorded country, and check what the content string looks like for
them.
- Write the filter that would restrict retrieval to one country's orders, and state where that filter must
be enforced.
Deliverable
A review sign-off: five sample rows, the grain and uniqueness checks with their results, the defect you found in step 5 and its fix, and one sentence on permission enforcement.
Check your work
- Rows: 1,000. Distinct
doc_id: 1,000. Grain preserved through the customer join. - Order 501's content reads:
Order 501 placed on 2026-06-21 for IN. Status completed. Total 1000.00.
That names its own subject, so it survives being retrieved alone.
- Average content length is 71.6 characters, maximum 84, with zero empty rows.
- 62 orders belong to customers with no recorded country. Without a
COALESCE, their content ends
for . Status completed. - a sentence that reads as broken and tells the model nothing. Wrapping the column in COALESCE(c.country, 'unknown country') fixes it.
The sentence about permissions
Restricting retrieval belongs in the WHERE clause of the query that fetches candidate rows - never in an instruction asking the model to ignore what it has been shown. If a restricted row reaches the context window, treat it as disclosed, regardless of what the assistant then says about it.
