• Prompts
  • Tools
    Prompt GeneratorTop AI Tools
  • Free Guides
  • Products
  • Contact us
  • Blog
  • Prompts
  • Free Guides
  • Products
  • Contact us
  • Blog
Custom Prompts
God of Prompt

About God of Prompt

Cutting-edge AI products for streamlining
your workflow.

XLinkedInYouTubeInstagram

Platform

  • Prompt Library
  • Free Guides
  • Prompt Generator
  • AI Tools
  • Products

Team

  • Support
  • Partnerships

© 2026 God of Prompt. All rights reserved.

Partnerships: [email protected]Privacy PolicyTerms & Conditions

2AI PromptsforSQL Queries

  • All Data Analysis
  • SQL Queries2
  • Data Insights
  • Reporting & Dashboards
  • Data Cleaning19
  • Data Visualization19
  • A/B Testing13
  • Spreadsheets & Formulas11
  • Data Insights prompts
  • Reporting & Dashboards prompts
  • Data Cleaning prompts
  • Data Visualization prompts
  • A/B Testing prompts
  • Spreadsheets & Formulas prompts
  • SQL Queries prompts
## Role

You are a database modernization specialist transforming legacy SQL into clean, maintainable SQL:2016 standard code.

## Task

Modernize the provided SQL queries by:

- Replacing correlated subqueries with window functions
- Implementing common table expressions (CTEs) for complex logic
- Converting nested conditionals to clean CASE expressions
- Eliminating comma-separated FROM clauses with proper JOIN syntax
- Standardizing string concatenation
- Restructuring complex queries into logical, step-by-step CTEs with descriptive names that explain business purpose
- Replacing proprietary database functions with SQL:2016 standard equivalents

## Context

These legacy queries contain outdated syntax patterns, proprietary extensions, and complex nested logic that create technical debt, break during upgrades, and confuse developers.

{{modernization-priorities}}

## Input

{{legacy-sql

🔄Modernize Legacy SQL Queries

OpenAIChatGPTData AnalysisSQL Queries

Transforms outdated SQL into clean SQL:2016 standard code by replacing correlated subqueries, nested logic, and proprietary syntax with CTEs, window functions, and modern JOIN patterns. Runs on ChatGPT, Claude, Gemini, and Grok.

14
## Role

You are an expert Database Architect specializing in high-performance SQL query optimization. You apply Baron Schwartz's optimization principles to minimize database load while maximizing insight extraction.

## Task

Guide the user through creating optimized SQL queries by adapting your approach to their database environment, query complexity, performance constraints, and SQL expertise. Dynamically adjust the depth and number of phases (3-15) based on requirements:

- **Simple queries**: 3-5 phases
- **Multi-table operations**: 6-8 phases
- **Complex analytics**: 9-12 phases
- **Enterprise optimization**: 13-15 phases

## Context

{{database-context}}

## Process

### Phase 1: Database Discovery & Requirements

Gather the database landscape details:

1. Database system (MySQL, PostgreSQL, SQL Server, Oracle, other)
2. Primary query goal (reporting, real-time lookup, analytics, 

⚙️SQL Query Optimization Prompt for Database Performance

OpenAIChatGPTData AnalysisSQL Queries

Guides you through creating optimized SQL queries using Baron Schwartz's principles, adapting from 3 to 15 phases based on complexity. Runs on ChatGPT, Claude, Gemini, and Grok to analyze schemas, design efficient joins, and improve query performance across MySQL, PostgreSQL, SQL Server, and Oracle.

11
MarketingDesignEducationFinanceSalesCodingWritingSEOStrategyProductivityOperationsHuman ResourcesResearchLegalData AnalysisReal EstateCustomer ServiceCareersAudioAI AgentsVideo

What are AI prompts for SQL Queries?

AI prompts for SQL Queries are engineered instructions that already work — not one-line questions. Each one fixes the role, the context, the task and the output format before you type a word, so you get a usable result on the first run instead of the fourth.

They cover the work SQL Queries actually get asked for: research and briefs, copy and content, analysis and reporting, planning, outreach and the admin that eats the day. Open a card to see the full prompt and the output it returns.

2 on this page, every one scoped to SQL Queries — free to read, free to copy.

Why these prompts work for SQL Queries

A weak prompt costs you the hour you were trying to save: you rewrite it three times, get something generic, then finish the job by hand. An engineered prompt front-loads that thinking once.

In SQL Queries that means first drafts you can send, analysis you can act on, and the repetitive work handed off — so the time goes into judgement instead of typing.

Every prompt here was written for a real job and tested against the models people actually use. Nothing scraped from a thread.

How to use these prompts

Open a prompt, copy it, and replace the [bracketed] variables with your own product, audience or topic. The structure around them stays as is — that structure is the part doing the work.

Paste it into ChatGPT, Claude, Gemini, Grok or the model you already use. If the output drifts, tighten the context line instead of rewriting the whole prompt.

No account needed to copy one. No setup, no extension, nothing to install.

Which AI tool works best for SQL Queries prompts?

Text prompts here run well in ChatGPT, Claude, Gemini and Grok; image prompts target Midjourney and Nano Banana. Each card lists the models it was tested with.

Are these AI prompts free to use?

A big part of the library is free: open a prompt, copy it, use it. Premium packs and the Complete AI Bundle unlock the full collection with lifetime updates.

How do I adapt these prompts to my use case?

Start with the [variables]: niche, audience, constraints. If the result still misses, add one example of the output you want — a single good example beats three extra instructions.

For a prompt built from scratch, the Start Now card above opens the custom prompt generator.

Related resources

ChatGPT Prompts for SQL QueriesClaude Prompts for SQL QueriesGemini Prompts for SQL QueriesGrok Prompts for SQL QueriesSQL Queries AI Prompts for SolopreneursSQL Queries AI Prompts for EntrepreneursSQL Queries AI Prompts for Business Owners