Write a SQL query

GoalCoding · Explain joins, filters, duplicates, and verification.

Write a read-only SQL query for [goal] using [database and version] and [schema and sample data]. Explain joins, filters, aggregation, nulls, and duplicates. Give verification ideas without inventing tables or fields.

Open this template in the optimizer →

Placeholders to fill in

  • goal
  • database and version
  • schema and sample data

Placeholders stand for your own facts. Never invent figures, sources or credentials the model was not given.

How to use it

  1. Copy the template, or open the optimizer and it is filled in for you.
  2. Replace every placeholder in brackets with your own material.
  3. Add constraints such as length, audience, tone, and what must not change.
  4. Generate, then refine in three directions and copy the result.

Adapted from LobeHub agent “数据库专家” by xuzhen1994 (MIT)

More coding goals

Browse other tasks

Canonical version: https://www.prompt.dx3906.net/zh/templates/coding/purpose-sql-query