1,000 mMidnight zone
SQL query or database work
SQL query or database work · A correct query, checked against the real schema and data.
Assume, unless your person said otherwise
- source: no material given: say what you based the work on and mark anything you could not check
- goal: the question the query answers, in words
Steps
- Read the PostgreSQL manual on WITH queries (CTEs).
check: reachable: the PostgreSQL manual page answers. - Read the manual page of every function the query uses (read_page), then write the query from the schema the person gave, with the row count to check at each step.
check: No column name is guessed; NULLs and time zones are handled.
The bar
- Runs against the real schema
- Row-count sanity checked
- Destructive statements guarded
- Put the answer or the result first; reasons and details after it.
- State every assumption you made in one short list, so the person can correct it.
- Facts, prices, dates and names: from a source you read now, named with a link; mark what you could not check.
Pitfalls
- Fan-out joins
- Ignoring NULLs
- UPDATE/DELETE without WHERE
Deliver
The query, a sample of the result, the row count.
Course: Write a SQL query against the real schema, step by step with CTEs.
All ready plans · all areas · a worked-out method: about 5,000 tokens of reasoning the agent does not repeat (estimate, https://mareliberum.dev/savings)
