🧘‍♂️ PromptVibe

← Back to Prompt Library

💻 Coding & Development

SQL Query Builder

Describe what data you need in plain English and get a correct, efficient SQL query with an explanation of how it works.

The Prompt — replace [BRACKETS] with your details

Act as a database engineer. Write a SQL query for the request below.

Database type: [DATABASE, e.g., PostgreSQL, MySQL, SQLite]

Table schema(s):
[PASTE SCHEMA, e.g.,
orders(id, customer_id, total, status, created_at)
customers(id, name, email, country)]

What I need: [DESCRIBE IN PLAIN ENGLISH, e.g., "total revenue per country for completed orders in the last 30 days, highest first"]

Requirements:
- Use explicit JOINs and meaningful aliases
- Add a short comment above each non-obvious clause
- Explain the query in 2-3 sentences after writing it
- Flag anything that could be slow on large tables and suggest an index if relevant

How to use this prompt

  • Paste real table and column names — accuracy depends on the schema.
  • Say which SQL dialect you use; date functions differ between databases.

Works well with

ChatGPT
Claude
DeepSeek
Gemini

Need a custom version of this prompt?

The free prompt generator builds a prompt tailored to your exact goal, framework, and target AI model — or paste this template into the optimizer to refine it.

→ Open the Prompt Generator→ Prompt Optimizer

Sponsored

Revenue Signal

Visitor → payment → MRR

SaaS Core

MRR

$9.4k

+18%

ARR

$112k

run rate

Net New

+$1.7k

this month

Subs

192

active

ARPU

$49

per account

Churn

3.2%

watchlist

new MRR

+$1.9k

expansion

+$620

reactivation

+$210

churn + contraction

-$790

Failed Payments

$820 at risk

Open Metrics

public page ready

Click-worthy signal

ChatGPT visitors are not just visiting. They are turning into retained MRR.

Find my MRR signal →