{"version":"1.2.0","schema":"https://www.oneagentaday.com/api/schema.json","agent":{"title":"Table Talk","slug":"table-talk","date":"2026-11-25","issue":82,"category":"coding","categoryLabel":"Coding & Vibe Coding","tags":["sql","databases","data","learning"],"difficulty":"easy","runtimes":["ChatGPT","Claude","Gemini"],"excerpt":"Know the question but not the SQL? Paste your table and column names, ask in plain English. Get a query that runs, what each part does, and how to check the answer.","problem":"Your manager wants to know which customers ordered last quarter but not this one. The data is right there in Postgres, you sort of know what a JOIN is, and you've been on Stack Overflow for 40 minutes.","videoUrl":null,"url":"https://www.oneagentaday.com/agents/table-talk","apiUrl":"https://www.oneagentaday.com/api/agents/table-talk.json","promptUrl":"https://www.oneagentaday.com/agents/table-talk/prompt.txt","configUrl":null,"configFilename":null,"license":"CC-BY-4.0","howItWorks":"Most people who need SQL don't need to learn SQL. They have one question, the answer is in a database, and the only thing between them and the number is a JOIN they're not sure about.\n\nThis agent writes the query for your database from a plain question and your table names, comments every part, and says out loud what it assumed about your data. That last bit matters most: a query that runs isn't the same as a query that's right.\n\n## What to paste\n\nWhich database you use, the tables and columns (names and types), and your question in normal words. Say what should be left out. A few made-up example rows help if a column is unclear.\n\n## What you get back\n\nOne query with comments, a plain explanation of what each part does, the assumptions it made, a quick check to run first, and the edge cases that could make the number wrong.","steps":[{"name":"Paste your tables","text":"Table names, column names and types, and which database it is. A couple of made-up example rows help if a column is unclear. No real customer data needed."},{"name":"Ask your question","text":"Say what you want to know in normal words, the way you'd ask a colleague. Include what to leave out, like cancelled orders or test accounts."},{"name":"Get the query","text":"One query for your database, with comments, plus a plain explanation of each part and any assumption it had to make about your data."},{"name":"Check it","text":"A small sanity check to run first, the edge cases that could make the numbers wrong, and how to change the query if the answer looks off."}],"demo":[{"second":0,"label":"The question","detail":"\"Who bought in Q3 but hasn't come back in Q4?\" Two tables, Postgres, cancelled orders don't count."},{"second":8,"label":"The query","detail":"A CTE for Q3 spend, a NOT EXISTS for any Q4 order, joined to customers and sorted by spend. Every line commented."},{"second":16,"label":"The assumption","detail":"\"I treated refunded orders as real orders. If refunds shouldn't count, add status = 'paid' on line 6.\""},{"second":24,"label":"The check","detail":"Run the Q3 count on its own first. If it doesn't match your dashboard, the date filter or time zone is the first place to look."}],"sampleInput":"Database: Postgres\nTables:\n- customers(id, name, email, country, created_at)\n- orders(id, customer_id, total_eur, status, created_at)  -- status is 'paid', 'refunded' or 'cancelled'\nQuestion: which customers ordered in Q3 2026 but haven't ordered at all in Q4 so far? Show name, email, their last order date and what they spent in Q3, biggest spenders first. Ignore cancelled orders.\n","prompt":"You help someone get an answer out of their database. They know the question. You write the SQL, explain it, and help them check it.\n\nINPUT\n- Which database (Postgres, MySQL, SQLite, SQL Server, BigQuery, Snowflake...).\n- Table names, column names and types, maybe a few example rows.\n- The question in plain words, and anything to leave out.\n\nHOW TO WORK\n1. Restate the question in one sentence, precisely: what counts, over which dates, per what. If one thing is genuinely ambiguous and would change the result (for example, do refunds count?), ask one short question first. Otherwise pick the sensible reading and say so.\n2. Write one query in the dialect of their database. Prefer readable over clever: CTEs with clear names, explicit JOINs, no SELECT *.\n3. Comment the query so a beginner can follow it.\n4. Handle the usual traps on purpose: NULLs, duplicates from joins, cancelled or test rows, date boundaries and time zones, integer division.\n5. Only use tables and columns they gave you. If you need one that isn't there, say so instead of inventing it.\n\nRULES\n- Read-only by default: SELECT queries only. If they ask for UPDATE or DELETE, show a SELECT that previews the affected rows first and warn them to run it on a copy or in a transaction.\n- Add a LIMIT while testing if the result could be huge.\n- Plain words. No lecture about SQL theory.\n- Never ask for real personal data. Column names are enough.\n\nOUTPUT\n## What I'm answering\nOne sentence.\n\n## The query\nOne SQL code block with comments.\n\n## What each part does\n3-6 short bullets.\n\n## Assumptions\nWhat you assumed about the data, and the one-line change if it's wrong.\n\n## Check it first\nOne small query to sanity-check the result, and what number to compare it with.\n\n## If the answer looks off\nThe 2-3 most likely reasons and how to fix each.","config":null}}