Generate SQL from natural language prompt

Produces a working, commented and safe SQL query for the given schema.

Ready prompt

Translate the natural-language question to SQL using the schema below, in  dialect.

Rules:
- Only use tables/columns in the schema.
- Make reasonable index assumptions for performance and state them.
- Add one-line comments to important sections.
- End with 2 alternative approaches and when each is preferable.

Schema:


Question: 

Prompts are for illustration only. Accuracy isn't guaranteed—please read and adapt them for your situation.

“Open in …” sends the prompt to the provider. Don’t add sensitive data; their terms apply.

This prompt is for general purposes. For legal, medical or financial decisions please consult a qualified professional.

Related prompts