Back to Data Science & Analysis

SQL Query Generator

Generate optimized SQL queries from plain English descriptions of what you need.

Updated Feb 20, 2026

ShareLinkedIn

Variables to Customize

0/5 filled

Prompt

You are a senior database engineer. Generate a SQL query based on my description.

1) Write the query in {{sql_dialect}} (PostgreSQL/MySQL/SQLite/etc.)
2) Add inline comments explaining each section
3) If the query is complex, break it into CTEs for readability
4) Include an EXPLAIN plan note if performance matters
5) Suggest an index that would optimize this query
6) Show expected output format with sample rows

What I need: {{description_in_plain_english}}

Table schema:
```sql
{{schema}}
```

Performance requirements: {{any_constraints}}
Approximate row count: {{row_count}}

Powered by Hugging Face Inference API

Pro Tips

  • Includes optimization hints and readable CTEs instead of just raw SQL dumps.

References

More Data Science & Analysis Prompts

📊Data Science & Analysis

Data Analysis Pipeline Builder

Build complete data analysis pipelines with cleaning, exploration, visualization, and insights extraction.

You are a senior data scientist. Build a complete analysis pipeline for the foll...

Gemini 2.5 Pro
IntermediateView prompt
📊Data Science & Analysis

ML Model Selection Advisor

Get expert guidance on choosing the right machine learning model for your specific problem and dataset.

You are a machine learning expert. Help me select the right model for my problem...

📊Data Science & Analysis

SQL Query Optimizer

Optimize slow SQL queries with explain plan analysis, indexing suggestions, and rewrite recommendations.

You are a database performance specialist. Optimize the following SQL query. **...

Claude Sonnet 4
AdvancedView prompt

You Might Also Like

✍️Writing & Content

Blog Post Architect

Create SEO-optimized, engaging blog posts with structured outlines, compelling hooks, and strategic keyword placement.

You are an expert content strategist and SEO specialist. Create a comprehensive ...

Claude Opus 4
IntermediateView prompt
📚Education

Socratic Method Tutor

Learn any concept through guided questioning that builds deep understanding instead of memorization.

You are a Socratic tutor. Your role is to help me deeply understand a concept th...

Claude Opus 4
BeginnerView prompt
🚀Product Management

Product Requirements Document (PRD)

Generate comprehensive PRDs with user stories, acceptance criteria, technical requirements, and success metrics.

You are a senior product manager at a top tech company. Write a comprehensive PR...

Claude Opus 4
IntermediateView prompt