Council LogoCouncil
coding•5 prompts

AI SQL Prompts

SQL is where AI provides the most immediate productivity boost. Describe what you want in plain English and get optimized queries, even for complex multi-table joins and window functions.

1. Query from Plain English

Best: ChatGPT
Write a SQL query that [describe in plain English what you want]. My tables: [list table names and key columns, or paste CREATE TABLE statements]. Database: [PostgreSQL/MySQL/SQLite]. Include comments explaining each section. If the query needs multiple steps, use CTEs for readability.
Include your table schema and sample data. ChatGPT generates clean, well-commented SQL.

2. Query Performance Optimizer

Best: DeepSeek
This query is slow: [paste query]. Execution time: [current time]. Table sizes: [row counts]. Current indexes: [list]. Diagnose why it's slow, rewrite it for performance, explain what indexes to add, and estimate the improvement. Show the execution plan logic. Database: [type and version].
Include EXPLAIN output if available. DeepSeek excels at identifying query plan inefficiencies.

3. Database Schema Designer

Best: Claude
Design a database schema for [application type]. Requirements: [list key entities and relationships]. Consider: normalization (3NF unless you justify denormalization), indexing strategy, common query patterns I'll need, and scalability to [expected data volume]. Provide CREATE TABLE statements with constraints and a brief ERD description.
Describe your most common queries. Claude designs schemas that are normalized but practical.

4. Complex Reporting Query

Best: Claude
Build a reporting query that shows: [describe desired report output]. Data sources: [tables and relationships]. Include: aggregations by [dimensions], year-over-year comparison, running totals using window functions, and NULL handling. Format the output for [downstream tool - e.g., "Excel pivot table" or "dashboard API"]. Use CTEs for readability.
Describe the final report layout. Claude structures complex queries with clear CTEs.

5. Data Migration Script

Best: Claude
Write a SQL migration script from [old schema] to [new schema]. Old structure: [describe]. New structure: [describe]. Handle: data type conversions, splitting/merging columns, default values for new required fields, referential integrity during migration, and a rollback strategy. Include verification queries to confirm the migration worked.
Include sample data from the old schema. Claude handles edge cases in migrations carefully.

Try These Prompts with Multiple AIs

Get responses from Claude, ChatGPT, Gemini, and more—all at once. Compare which AI handles these prompts best.

Try Council Free

Related Prompt Templates

Data Analysis AI Prompts

5 prompts

AI Excel & Spreadsheet Prompts

5 prompts

AI Coding Prompts

5 prompts

Compare AI

  • Claude vs ChatGPT
  • ChatGPT vs Gemini
  • Claude vs Gemini
  • Claude vs DeepSeek
  • ChatGPT vs DeepSeek
  • Claude vs Perplexity
  • ChatGPT vs Perplexity
  • Claude vs Grok
  • ChatGPT vs Grok
  • Gemini vs Grok
  • Gemini vs DeepSeek
  • Gemini vs Perplexity
  • Grok vs DeepSeek
  • Grok vs Perplexity
  • DeepSeek vs Perplexity

AI Models

  • Claude
  • ChatGPT
  • Gemini
  • Grok
  • DeepSeek
  • Perplexity

Best AI For

  • Best AI for Coding
  • Best AI for Writing
  • Best AI for Research
  • Best AI for Business
  • Best AI for Students
  • Best AI for Math
  • Best AI for Data Analysis
  • Best AI for Creative
  • Best AI for SQL
  • Best AI for Essays
  • Best AI for Emails
  • Best AI for Code Review

AI By Industry

  • AI for Developers
  • AI for Marketers
  • AI for Writers
  • AI for Lawyers
  • AI for Entrepreneurs
  • AI for Students
  • AI for Designers
  • AI for Sales
  • AI for Finance
  • AI for Healthcare
  • AI for Educators
  • AI for Consultants

Resources

  • What is an LLM?
  • Prompt Engineering
  • AI Hallucinations
  • Context Window
  • RAG
  • Chain of Thought
  • AI Agents
  • AI Benchmarks
  • About Council

Guides

  • How to Write Emails with AI
  • How to Analyze Data with AI
  • How to Write Code with AI
  • How to Debug Code with AI
  • How to Summarize Docs with AI
  • Is Claude Better Than ChatGPT?
  • Can AI Write Code?
  • Which AI is Best for Coding?
  • Is ChatGPT Plus Worth It?

Alternatives

  • ChatGPT Alternatives
  • Claude Alternatives
  • Gemini Alternatives
  • Perplexity Alternatives
  • Grok Alternatives
  • DeepSeek Alternatives

Features & More

  • AI with Web Search
  • AI Image Generation
  • AI with Long Context
  • AI with Citations
  • AI APIs for Developers
  • Free AI Assistants
  • AI with Reasoning Mode
  • AI Prompt Templates
  • AI Workflows
  • AI by Role
Council LogoCouncil

© 2026 Council AI Inc. All rights reserved.

TermsPrivacy PolicyContact