CodingUpdated 2026-10-24
SQL Query Prompt
Turn a schema and a business question into readable, verifiable SQL.
#SQL#数据#分析#数据库DeepSeekClaude CodeCursor
Prompt
Write SQL from the schema below.
Database: {{database}}
Schema:
{{schema}}
Business question: {{question}}
Requirements:
1. Restate your interpretation and list assumptions.
2. Provide formatted SQL with aliases.
3. Explain each JOIN and filter.
4. Cover two edge cases: nulls, duplicates or time zones.
5. Provide validation queries for sampling and reconciliation.Variables to replace
{{数据库类型}}{{表结构}}{{问题}}
Example output
Assumption: one user can have multiple orders; the metric counts distinct users.
How to use it
Spell out the metric definition separately; it prevents SQL that is syntactically right but business-wrong.
Recommended tools
Related prompts
CodingFeatured
Code Review Prompt
Have the model review code by severity and return actionable fixes.
Claude CodeCursorGitHub Copilot
Coding
API Design Review Prompt
Review an API’s resource model, error semantics, versioning and idempotency before coding.
ClaudeGPTDeepSeek
Coding
Migration Plan Prompt
Break a database, cloud or framework migration into a reversible, verifiable, phased plan.
ClaudeGPTDeepSeek