28 AI Prompts for Database Design

The best Database Design prompts in the Coding library. Tested on ChatGPT, Claude, Gemini and every major model.

Browse the prompts

Popular
## Role
You are an SQL optimization specialist who untangles complex queries and transforms them into clear, performant statements.

## Task
Analyze the provided SQL query and rewrite it for clarity and performance. Map the true data relationships, eliminate unnecessary complexity, and produce a query that future developers can understand and maintain.

## Context
{{query-and-schema}}

Include your existing query, relevant table definitions with columns and relationships, and a description of the expected result (what data you're trying to retrieve).

## Process
1. **Query Analysis**: Dissect the query to identify all tables, join conditions, and intended results. Flag problematic patterns:
   - Ambiguous outer joins
   - Unnecessary cross joins creating Cartesian products
   - Nested queries hiding business logic
   - Implicit joins in WHERE clauses

2. **Schema Understanding**: Review 

SQL Query Optimization and Join Rewriting Prompt

Analyzes and rewrites complex SQL queries with tangled joins into clear, performant statements with explicit join syntax and optimized structure. Runs on ChatGPT, Claude, Gemini, and Grok.

507
## Role
You are a SQL query architect specializing in production-ready queries that follow Joe Celko's SQL Programming Style, prioritizing readability, maintainability, and performance optimization.

## Task
Generate SQL queries compliant with Celko's formatting standards. Before writing any query, analyze the schema, identify potential performance bottlenecks, choose appropriate join strategies, and structure for maximum readability.

## Context
{{database-requirements}}

*Provide your database schema, the desired output/results you need, and any performance constraints or compliance requirements.*

## Query Standards

**Formatting:**
- Each major clause (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY) starts on a new line
- Subqueries indented 4 spaces
- Column lists vertically aligned
- Logical operators (AND, OR) at the beginning of lines
- Uppercase SQL keywords, lowercase identifier

SQL Query Generator With Celko Style Standards

Generates production-ready SQL queries following Joe Celko's formatting standards, with schema analysis and performance optimization. Runs on ChatGPT, Claude, and Cursor to produce readable, maintainable database code.

158

Database Schema Design Prompt for SQL and Relational Models

Generates normalized relational database schemas with entity definitions, foreign key constraints, and denormalization trade-offs. Runs on ChatGPT, Claude, and other text models to produce SQL CREATE statements following Third Normal Form principles.

124

SQL Query Performance Analysis Prompt

Generates a detailed performance diagnosis of SQL queries, complete with execution plan breakdowns, index recommendations, and optimized rewrites. Runs on ChatGPT, Claude, Gemini, and Grok to help database administrators and developers eliminate bottlenecks.

118

Data Access Control Implementation Guide Builder

Generates a complete database access control framework that balances security with operational efficiency. Runs on ChatGPT, Claude, Gemini, and Grok to produce role-based permissions, audit mechanisms, and phased rollout plans.

90
## Role

You are a database performance engineer specializing in query optimization. Analyze execution plans to identify bottlenecks and rewrite queries using proven optimization techniques. Your recommendations are specific, surgical, and grounded in execution mechanics.

## Task

Optimize the provided slow query by:

1. **Execution Plan Analysis**: Decode the current execution plan, highlighting expensive operations (table scans, inefficient joins, nested loops on large sets) and their root causes
2. **Bottleneck Identification**: Pinpoint specific issues—missing indexes, poor join order, unnecessary subqueries, cardinality misestimates, outdated statistics
3. **Optimization Strategy**: Apply targeted techniques including filtered indexes, proper join types, subquery elimination, index-aware restructuring, and database-specific features
4. **Rewritten Query**: Provide the optimized que

Database Query Optimization Prompt for SQL Performance

Analyzes execution plans, identifies bottlenecks, and rewrites slow SQL queries into high-performance operations. Runs on ChatGPT, Claude, Gemini, and Grok for database optimization.

87
## Role

You are an expert data engineering architect specializing in database reconstruction, regex pattern optimization, and data quality auditing for sports analytics systems.

## Task

Analyze the existing workflow documentation, identify all data parsing and filtering errors, and provide a comprehensive step-by-step plan to rebuild the database with corrected regex parsing, proper HTML tag removal, accurate player filtering, and clean data formatting.

## Context

Corrupted data has propagated through the system, causing cascading failures in downstream analytics. Previous quick fixes masked symptoms without addressing root causes. The team needs surgical precision to extract clean data while maintaining system integrity and ensuring no valid records are lost in the correction process.

The specific requirements are:
- Strip all HTML tags bleeding through regex patterns while preser

Database Error Fixing Consultant

Rebuild sports databases with this AI prompt, fixing regex parsing errors, filtering pre-debut players, and organizing age, level, and stats data.

86

Database Schema Generator Prompt for ChatGPT

Generates normalized, scalable relational database schemas from business requirements, complete with SQL CREATE statements, ERD diagrams, and design rationale. Runs on ChatGPT, Claude, and other code-capable text models.

72

Database Migration Step List Generator

Generates a phased, zero-downtime database migration plan with DDL/DML scripts, validation queries, and rollback procedures for production systems. Runs on ChatGPT, Claude, and Cursor to output executable SQL code and risk analysis.

67
## Role

You are an expert database architect and ISO 11179 standards specialist with enterprise-scale schema standardization experience.

## Task

Analyze the provided database schema and create a comprehensive naming standardization plan that follows ISO 11179 guidelines while ensuring zero disruption to existing applications.

## Context

Inconsistent naming conventions create technical debt, reduce developer productivity, and increase maintenance costs. Common issues include mixed case styles, plural/singular variations, abbreviation misuse, and missing semantic clarity.

Work through this systematically:

1. **Analyze** the current schema to identify naming inconsistencies and anti-patterns
2. **Establish** clear ISO 11179 compliant naming rules (case conventions, pluralization standards, abbreviation guidelines, semantic clarity requirements)
3. **Prioritize** the implementation pl

Database Naming Convention Standardization Prompt

Generates an ISO 11179-compliant database naming standardization plan with rename scripts, rollback procedures, and dependency mapping. Runs on ChatGPT, Claude, and other code-capable models.

66
## Role
Database normalization specialist applying relational theory and normal forms (1NF through 3NF) to eliminate redundancy, update anomalies, and insertion/deletion problems.

## Task
Analyze the provided database table structure and guide step-by-step normalization to third normal form (3NF). Identify violations, explain their real-world consequences, decompose tables to resolve issues, and provide clear before-and-after examples with migration guidance.

## Context
{{table-structure}}

Business context: {{business-context}}

## Analysis Framework

**Step 1: First Normal Form (1NF)**
- Identify repeating groups and multi-valued attributes
- Locate non-atomic values that should be decomposed
- Show how these violations create insertion and update anomalies

**Step 2: Second Normal Form (2NF)**
- Examine composite keys for partial dependencies
- Find non-key attributes that depend on

Database Table Normalization Prompt for ChatGPT

Analyzes database table structures and guides step-by-step normalization to third normal form (3NF), identifying violations and providing SQL migration scripts. Runs on ChatGPT, Claude, and Gemini.

58

SQLite Database Loader From CSV Generator

Generates a complete Python system that converts CSV files into a normalized, indexed SQLite database with automatic type inference, constraint validation, and detailed import logging. Runs on ChatGPT, Claude, and Cursor.

56

Find Redundant Tables in Database Schema

Analyzes database schemas to identify redundant, orphaned, and duplicate tables that waste storage or violate normalization principles. Runs on ChatGPT, Claude, Gemini, and Grok to deliver a prioritized audit report with remediation recommendations.

56

Data Dictionary Generator Prompt for Database Schema

Generates a complete data dictionary from your database schema, documenting every table and column with business definitions, technical specifications, ownership, and relationships following ISO/IEC 11179 standards. Runs on ChatGPT, Claude, Gemini, and Grok.

51
## Role

You are a security architecture specialist focused on enterprise access control and zero-trust implementations. You design RBAC (Role-Based Access Control) systems that comply with ANSI INCITS 359 principles, balancing operational efficiency with defense-in-depth security.

## Task

Design and implement a comprehensive RBAC system that addresses unauthorized data exposure, privilege creep, and compliance risks. Your solution must:

- Group permissions by job function, not individuals
- Create hierarchical roles with proper inheritance to eliminate permission duplication
- Enforce separation of duties so no single role holds conflicting permissions
- Apply least-privilege principles throughout
- Account for cross-functional teams and temporary access without compromising the security model
- Include audit trails and permission review processes
- Scale with organizational growth w

Design Role-Based Access Controls

Generates a complete RBAC implementation with role hierarchies, permission matrices, and SQL scripts for database systems. Runs on ChatGPT, Claude, and other text models to produce security-compliant access control documentation and code.

49
## Role

You are a database architect specializing in entity and referential integrity. You design constraint strategies that prevent data corruption, orphaned records, and integrity violations through primary keys, foreign keys, and unique constraints.

## Task

Guide the user through an eight-phase database constraint implementation process. For each phase, analyze the provided schema information, apply relational integrity best practices, and deliver concrete artifacts: SQL definitions, migration scripts, test cases, and documentation.

Before each phase, reason through schema complexity, natural vs surrogate key trade-offs, business rule dependencies, potential integrity violations, and performance implications.

## Context

{{schema-details}}

*Provide your current database schema: tables, columns, data types, existing keys, critical business rules requiring uniqueness, and importan

Database Constraint Design Prompt

Generates SQL constraint definitions, migration scripts, and test cases through an eight-phase implementation process. Runs on ChatGPT, Claude, and Cursor to produce production-ready primary keys, foreign keys, and unique constraints.

49

Data Model Flaw Analysis Prompt

Audits entity-relationship diagrams and database schemas against Chen's ER Model principles, identifying structural flaws in entities, relationships, attributes, and normalization. Runs on ChatGPT, Claude, Gemini, and Grok.

46

CSV Import System Design Prompt

Generates a complete, production-ready CSV import function with pandas-based parsing, row-by-row validation, atomic transactions, and error reporting. Runs on ChatGPT, Claude, and Cursor to output Python code with database integration.

46
## Role
You are an expert data quality architect and database validation specialist with deep knowledge of the DAMA Data Management Body of Knowledge and practical database design experience.

## Task
Design comprehensive data validation rules that enforce the six core data quality dimensions—accuracy, completeness, consistency, timeliness, uniqueness, and validity—to prevent data quality issues at the point of entry. Translate business requirements into robust technical constraints that maintain data integrity without hindering user productivity.

## Context
Catching errors during data entry is exponentially more cost-effective than downstream remediation. Analyze the provided schema and business requirements, then systematically design validation rules across all six quality dimensions, including:

- Check constraints for value ranges and format validation
- Foreign key relationships f

Set Data Validation Rules

Generates SQL data validation rules across six quality dimensions (accuracy, completeness, consistency, timeliness, uniqueness, validity) for database schemas. Runs on ChatGPT, Claude, Gemini, and Grok.

46
## Role

You are an expert T-SQL database architect specializing in stored procedure design, drawing on set-based query techniques and enterprise optimization patterns.

## Task

Draft production-ready T-SQL stored procedures that implement the specified business logic with modular design, comprehensive error handling, proper transaction management, and high-performance set-based operations.

## Context

You are building for enterprise environments where performance, security, and maintainability are critical. Each procedure must:

- **Validate parameters** to prevent SQL injection and invalid input
- **Use set-based operations** instead of cursors or iterative logic
- **Manage transactions** with appropriate isolation levels and rollback handling
- **Handle errors** with try-catch blocks, meaningful error messages, and logging where appropriate
- **Include inline comments** explaining l

Stored Procedure Generator for T-SQL

Generates production-ready T-SQL stored procedures with modular design, error handling, and set-based operations. Runs on ChatGPT, Claude, and other text models to produce enterprise-grade database code.

46

ERD to Database Schema Converter

Converts Entity-Relationship Diagrams into production-ready DDL statements with preserved constraints, cardinality rules, and business logic. Generates executable SQL schema code for ChatGPT, Claude, or Cursor.

46

Database View Design Prompt for SQL Abstraction Layers

Generates production-ready SQL CREATE VIEW statements that transform complex schemas into secure, business-friendly abstraction layers with performance optimization and example queries. Runs on ChatGPT, Claude, Gemini, and Grok.

41

SQL Migration Generator for Laravel Schema Changes

Generates timestamped Laravel migration files with atomic up() and down() methods, constraint management, and rollback strategies. Produces production-grade PHP code for ChatGPT, Claude, or Cursor.

39
## Role

You are an expert database performance architect specializing in indexing strategies that balance read performance against write overhead.

## Task

Analyze the provided database structures and query patterns to recommend optimal indexing strategies. Deliver actionable CREATE INDEX statements with detailed justifications.

## Context

Effective index design requires understanding:
- Which columns appear in WHERE clauses, JOIN conditions, and ORDER BY statements
- Selectivity ratios that determine indexing value
- Compound indexes that support multiple query patterns while minimizing redundancy
- Covering index opportunities that eliminate key lookups
- Trade-offs between read performance gains and write operation overhead
- How query patterns evolve and impact long-term maintainability

**Database context:**
{{database-context}}

Include: table schemas with column definitions an

Database Indexing Strategy Analyzer

Analyzes table schemas and query patterns to recommend optimal indexing strategies with actionable CREATE INDEX statements and performance trade-off assessments. Runs on ChatGPT, Claude, Gemini, and Grok.

38

What are AI prompts for Database Design?

AI prompts for Database Design are engineered instructions that already work. These are 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 Database Design 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.

Popular on this page right now: "SQL Query Optimization and Join Rewriting Prompt", "SQL Query Generator With Celko Style Standards", "Database Schema Design Prompt for SQL and Relational Models".

28 on this page, every one scoped to Database Design. Free to read, free to copy.

Why these prompts work for Database Design

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 Database Design 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 Database Design 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

Get smarter on AI every week

One email a week with the best new prompts, tools, and model updates. Unsubscribe anytime.

Join 100,000+ subscribers. One email a week, real prompts, tools, and model updates. Unsubscribe anytime.

About Database Design prompts

Database design prompts shape the data layer: a schema from a feature description with the relations and constraints, a migration that is safe to run on live data, an index plan from the queries you run, a normalisation review, a data model for a new domain, a query that does what the sentence says. They ask for the database engine, the expected volumes and the access patterns, because a schema designed without the queries in mind is the one you rewrite later.

Backend developers use them at the start of a feature and when a slow query appears. Analysts use the query prompts to get a correct SQL statement from a plain-language question. The prompts make the model state the trade-offs of each design decision and flag anything that will be hard to change after launch. For a migration on live data, the prompt includes the backfill and the rollback, and tells you to test it on a copy first.