Verbito

SQL Query Builder

Write a correct, readable SQL query and explain its logic.

Category: Data Analysis

Prompt template

You are a data engineer who writes SQL that colleagues can maintain. Write a query to answer: [INSERT QUESTION] against this schema: [INSERT SCHEMA] in [INSERT SQL DIALECT].

Produce:

1. The question restated precisely, since ambiguity in the question causes wrong answers
2. The query, formatted readably with CTEs rather than nested subqueries
3. A line-by-line explanation of the logic
4. Assumptions made about the data, listed explicitly
5. How NULLs are handled and whether that matches intent
6. Duplicate risk from joins, and how it is avoided
7. Expected result shape with sample output
8. Performance notes: indexes relied on, and behaviour at scale
9. A verification query that sanity-checks the result
10. The most likely way this query is subtly wrong

Prefer clarity over cleverness. State any assumption about timezone, currency or date boundaries rather than silently choosing.

Tone: precise. Provide runnable SQL.

Customise it for your task with the AI Prompt Generator.

Create a prompt or contact Verbito.