Skip to main content
idapt
AccueilModèles IATarifs
Sign inStart free
All prompts

Prompt library

Write SQL from a plain-language request

Most wrong SQL is a correct answer to a misread question, so the grain-and-edges restatement catches errors before they cost a table scan. The never-invent-columns rule plus the assumptions list makes silent schema hallucination visible.

EngineeringCodeSuggested model: moonshotai/kimi-k2.7-code

Last reviewed July 17, 2026

The prompt
Write a SQL query for the request below.

Schema: {{schema}}
Request: {{request}}
Dialect: {{dialect}}

Rules:
1. Before the query, restate the request in one sentence including grain (one row per what?) and edge decisions (ties, nulls, timezone, inclusive or exclusive date bounds). If the request is ambiguous, state the interpretation you chose.
2. Write the query with CTEs named after business concepts, not t1/t2.
3. Comment any line where a subtle choice hides (join type, null handling, dedup).
4. Then list what would silently break it: schema assumptions you made that the schema text did not confirm.
5. End with a 3-row mock of the expected output shape.

Never invent columns; if a needed column is missing from the schema, say which and stop.
Run in idaptOpens a new chat with the prompt prefilled. Nothing sends until you press send.

Fill in the variables

VariableWhat it isExample
{{schema}}The relevant tables and columnsorders(id, customer_id, total_cents, status, created_at), customers(id, country, created_at)
{{request}}What you want, in plain wordsmonthly revenue from completed orders for the last 12 months, split by customer country, including months with zero revenue
{{dialect}}The SQL dialectPostgreSQL

Frequently asked

Related prompts

Explain what a SQL query really doesBuild a regex with tests, not vibesPlan an exploratory analysis that answers a question

Ready to get to work?

Free to start. No credit card. Never trained on your data.

Start free
  • Accueil
  • Tarifs
  • Modèles IA
  • Modèles d'image
  • Modèles de voix
  • Modèles vidéo
  • Classements
  • New models
  • Model status
  • Multi-Model Chat
  • Voice Mode
  • Voice HUD
  • Web Search
  • Image Generation
  • Video Generation
  • Audio Generation
  • Transcription
  • Drive
  • Secrets
  • Sharing
  • Workspaces
  • Tasks
  • Memory
  • Agents
  • Subagents
  • Automations
  • Skills
  • Code Execution
  • Computers
  • Computer Use
  • Cloud Computers
  • Local AI
  • AI Gateway
  • API & SDK
  • CLI
  • MCP
  • Tunnels
  • All features →
  • Blog
  • Cas d'usage
  • Comparisons
  • Best of
  • Learn
  • Free tools
  • Prompts
  • Templates
  • Changelog
  • Centre d'aide
  • FAQ
  • Confidentialité
  • Comparer tous les modèles
  • Support
  • Développeurs
  • Quickstarts
  • Référence API
  • Tarifs API
  • CLI
  • MCP
  • Downloads
  • Desktop
  • Badges and embeds
© idapt[email protected]ConditionsPolitique de confidentialitéMentions légalesSignaler un contenu
X (Twitter)