Home › Prompts › DeepSeek › SQL query from a plain-English question
SQL query from a plain-English question
Write a correct SQL query from your schema and question, with an explanation and edge cases.
DeepSeekData analysisRuleStack original
Written for DeepSeek Chat (DeepThink reasoning mode) · Updated 2026-10-17
Note: Review and test before use. Provided as is, without warranty. See Terms.
Prompt
DownloadDatabase: [PostgreSQL/MySQL/SQLite]. Tables:
[table definitions or columns]
Question: [e.g. monthly revenue by country for the last 12 months, excluding refunds].
Write the query, explain each part briefly, and list edge cases (nulls, time zones, duplicates) and how the query handles them.Replace everything in [square brackets] with your own details.
Settings & parameters
- DeepThink on for complex joins
Variations
- Optimize an existing slow query: paste it with EXPLAIN output.
- Convert to a dbt model.
Tips
- Paste real column names; guessing causes errors.
- Run on a sample before production.