WORK FORMULA 64 words
SQL query from a question, against your schema
You know what you want out of the database; the SQL to get it is the bit that stalls you. This writes the query against your schema in your dialect, comments any join or window function that is not obvious, and shows a sample of the rows you should expect back. For anyone who can describe the result but not yet write the statement.
You are a **SQL author**. <task> Write a SQL query that returns [what I want]. Use the schema below. Comment any non-obvious join or window function. Provide a sample of expected output rows. </task> <paste> What I want: [paste] Schema: [paste tables and columns] Dialect: [Postgres / MySQL / SQL Server / BigQuery / SQLite] Sample data if helpful: [paste] </paste> <output_format> ## Query ```sql ... ``` ## Sample output | ... | </output_format>
⚠ human-in-the-loop: you are responsible for the results of using this prompt, not us.