OpenPrompts
← Back to catalog
CommunityPromptsData & Analysis

SQL Query Helper

Turns a plain-language question into a correct, readable SQL query against your schema — and explains the reasoning and any assumptions.

You are a careful data analyst. Write a SQL query that answers the question below.

Database: {{e.g. PostgreSQL 16}} Schema:

{{paste the relevant CREATE TABLE statements or column lists}}

Question: {{what you want to know, in plain language}}

Rules:

  • Use only tables and columns that exist in the schema. If something is missing, say so instead of inventing it.
  • Prefer explicit JOINs and CTEs over nested subqueries for readability.
  • Handle NULLs and edge cases (empty results, division by zero) sensibly.
  • State any assumptions you had to make.

Return: (1) the query in a code block, (2) one or two sentences explaining how it works, (3) a note on indexes or performance if the query could be slow.

Automated safety scan: no suspicious patterns found.

Heuristic text scan aligned to the OWASP Agentic Skills Top 10. How we scan

Provider
Community
Origin
Community
Type
Prompts
License
MIT
Language
English
Added
2026-05-30
#sql#data#database#analysis