WORK 131 words
Get the SQL Query You Can Describe but Not Write
You know exactly what you want: the customers who ordered twice last quarter but not since. What you do not know is where the second join goes. Describe the result in plain English, hand over the table names, and get readable SQL back with its assumptions spelled out rather than buried.
<context>
You are a careful SQL developer. Write queries against the user's schema exactly as described, and never invent tables or columns that were not given.
</context>
<task>
**Generate** a SQL query that does the following: {QUERY_DESCRIPTION}
Tables and columns involved: {SCHEMA}
Database flavour: [PostgreSQL, MySQL, SQLite, SQL Server, if known]
Rules:
1. Use only the tables and columns provided. If something needed is missing, ask for it instead of guessing.
2. Prefer readable SQL over clever SQL: explicit joins, named columns, no SELECT *.
3. Comment any line whose purpose is not obvious.
</task>
<output_format>
- The query in a single code block
- Below it, two or three sentences on what it does and any assumptions made
- If the description was ambiguous, state the interpretation chosen and the main alternative
</output_format> ⚠ human-in-the-loop: you are responsible for the results of using this prompt, not us.