Coding Advanced User Prompt

SQL Query Forensic Architect

For analysts and engineers who need accurate SQL for complex reporting, joins, and filtering.

๐Ÿ’ป
Rating
4.8
Difficulty
Advanced
Format
User Prompt
Variables
5
Download Prompt FREE

Best for these models

โ— Claude Opus 4.6 โ— ChatGPT (GPT-5.4) โ— Gemini 3.1 Pro

๐Ÿ“‹ The Prompt

User Prompt .txt

๐Ÿ”’ Prompt available in download

Get the full prompt text in a downloadable .txt file. Free, no signup required.

Download Prompt

Variables to fill in

{{BUSINESS_GOAL}} โ€” Replace with your input
{{SQL_DIALECT}} โ€” Replace with your input
{{SCHEMA}} โ€” Replace with your input
{{OUTPUT_COLUMNS}} โ€” Replace with your input
{{CONSTRAINTS}} โ€” Replace with your input

About this prompt

SQL Query Forensic Architect is designed for people who need precise queries from messy business questions. It guides the model to translate requirements into SQL query generation with careful attention to joins, grouping, null handling, and filtering logic. The template is useful when a vague request must become a query that actually runs against a real schema.

This prompt works well for data analysts, analytics engineers, and backend developers who regularly write reporting queries or debug broken dashboards. It asks the model to explain assumptions, identify ambiguous fields, and show the final query in a copy-pasteable format. You can use it for PostgreSQL, MySQL, SQL Server, BigQuery, or Snowflake by setting the dialect variable. It is particularly valuable when the task requires complex joins, window functions, or date logic that is easy to get wrong.

To customize, provide the table schema, desired output columns, and any business rules that affect filtering or aggregation. If performance matters, add index details and row count estimates so the model can suggest a more efficient plan. The prompt can also return a short validation checklist, which helps teams catch issues before the query reaches production dashboards or executive reports. This makes it a practical reporting query tool for daily use.

Key features

  • SQL query generation from plain-language business requirements
  • Handles complex joins, grouping, and date logic carefully
  • Supports multiple dialects with schema-aware output
  • Flags assumptions before writing the final query
  • Includes performance notes for large tables and dashboards

Best for

  • โ†’ Data analysts building executive reports
  • โ†’ Analytics engineers maintaining warehouse queries
  • โ†’ Backend developers debugging customer-facing SQL

Tips

  • ๐Ÿ’ก Paste the exact schema so the model can avoid guessing column names
  • ๐Ÿ’ก State the SQL dialect explicitly to reduce syntax errors
  • ๐Ÿ’ก Add performance constraints when queries must run on large datasets

What you'll get

You receive a short assumptions section, a ready-to-run SQL query, and a plain-English explanation of the logic. The response also includes performance notes such as index suggestions, join order considerations, and possible pitfalls with nulls or duplicate rows. This format helps you validate the query before running it in a BI tool or production job.

Preparing your download...

Download Prompt

Related prompts