+ It computes all requested metrics concisely in one CTE.
- Ordering is nondeterministic when quantities are tied.
Context: This prompt is used by AI2sql to generate SQL queries from natural language.
| Category | Development › Data & databases |
|---|---|
| Tags | DraftingDeveloperCodeTemplate |
Context:
This prompt is used by AI2sql to generate SQL queries from natural language.
AI2sql focuses on correctness, clarity, and real-world database usage.
Purpose:
This prompt converts plain English database requests into clean,
readable, and production-ready SQL queries.
Database:
${db:PostgreSQL | MySQL | SQL Server}
Schema:
${schema:Optional — tables, columns, relationships}
User request:
${prompt:Describe the data you want in plain English}
Output:
- A single SQL query that answers the request
Behavior:
- Focus exclusively on SQL generation
- Prioritize correctness and clarity
- Use explicit column selection
- Use clear and consistent table aliases
- Avoid unnecessary complexity
Rules:
- Output ONLY SQL
- No explanations
- No comments
- No markdown
- Avoid SELECT *
- Use standard SQL unless the selected database requires otherwise
Ambiguity handling:
- If schema details are missing, infer reasonable relationships
- Make the most practical assumption and continue
- Do not ask follow-up questions
Optional preferences:
${preferences:Optional — joins vs subqueries, CTE usage, performance hints}This developer prompt converts natural language into SQL for AI2sql. If schema details are missing, it infers practical relationships and avoids follow-up questions.
Gemini is the most concise and faithful; Claude adds an extra column, while ChatGPT repeats a join.
+ It computes all requested metrics concisely in one CTE.
- Ordering is nondeterministic when quantities are tied.
+ It clearly aggregates and returns quantity and revenue.
- Joining the products table twice is somewhat redundant.
+ It adds a tie-breaker for more stable result ordering.
- It unnecessarily includes the unrequested category column.
| Criterion | ChatGPT | Claude | Gemini | Leader |
|---|---|---|---|---|
| Instruction following | 9 | 9 | 10 | Gemini +11% |
| Accuracy | 9 | 9 | 9 | Tie |
| Specificity | 10 | 9 | 10 | Tie |
| Structure | 9 | 10 | 10 | Tie |
| Right length | 9 | 9 | 10 | Gemini +11% |
Scored 1–10 by gpt-5.6-sol with model names hidden (2026-09-24). This is an AI review, not a measurement.
We gave three models the same input and copied their answers unedited. Each ran in its CLI (an agent harness), and answers in the ChatGPT or Claude apps or on the web may differ. Outputs are in Korean.
[Pasted material] db: PostgreSQL schema: users(id, name, email, created_at), orders(id, user_id, product_id, quantity, order_date), products(id, name, price, category) prompt: 지난 30일 동안 가장 많이 팔린 상품 상위 5개와 각 상품의 총 매출을 보여줘 preferences: 서브쿼리보다 JOIN과 CTE를 선호
WITH product_sales AS ( SELECT o.product_id, SUM(o.quantity) AS total_quantity_sold, SUM(o.quantity * p.price) AS total_revenue FROM orders AS o JOIN products AS p ON p.id = o.product_id WHERE o.order_date >= CURRENT_DATE - INTERVAL '30 days' GROUP BY o.product_id ) SELECT p.id AS product_id, p.name AS product_name, ps.total_quantity_sold, ps.total_revenue FROM product_sales AS ps JOIN products AS p ON p.id = ps.product_id ORDER BY ps.total_quantity_sold DESC, ps.total_revenue DESC LIMIT 5;
| Advanced Text Converter for Large Datasets | |
| AI-powered data extraction and organization tool | |
| Backend Architect | |
| base-R | |
| Building a Scalable Search Service with FastAPI and PostgreSQL |