Prompt ChatGPT to Generate a Database Schema
Designing a database schema is a fundamental step in any software project. A well-thought-out schema ensures data consistency, optimizes query performance, and facilitates long-term maintenance. Yet this task requires expertise in relational modeling, normalization, and appropriate data type choices. ChatGPT can significantly accelerate this process by generating a structured schema from a functional description of your project. By providing the business context, main entities, and expected relationships, you get in seconds a complete SQL schema with primary keys, foreign keys, indexes, and constraints. The AI can also propose optimizations like targeted denormalization for read-heavy cases, or suggest proven patterns such as soft delete or table polymorphism. Whether you are working on a SaaS application, e-commerce, or internal management system, ChatGPT adapts the schema to your chosen DBMS—PostgreSQL, MySQL, SQLite, or SQL Server—while respecting each engine's conventions and native types.
The prompt
You are a senior database architect with 15 years of experience in relational modeling. I am developing a [PROJECT DESCRIPTION] application. Here are the main business entities: [ENTITY LIST]. The business rules are: [BUSINESS RULES]. The target DBMS is [PostgreSQL/MySQL/SQLite]. Generate a complete database schema in SQL with: 1) All tables with their columns, appropriate data types, and comments, 2) Primary keys (UUID or auto-increment depending on context), 3) Foreign keys with appropriate ON DELETE and ON UPDATE constraints, 4) Indexes on frequently searched or filtered columns, 5) Relevant CHECK and UNIQUE constraints, 6) Audit columns (created_at, updated_at, deleted_at if soft delete), 7) Junction tables for many-to-many relationships. After the SQL, provide a text-format relationship diagram and a list of design decisions with their justification.
Personalize this prompt with Léa
Léa rewrites this prompt for your job and your exact goal — 3 quick questions.
Why it works
This prompt works because it assigns a precise expert role to the AI, steering response quality towards a professional level. The numbered list of expected deliverables forces a comprehensive and structured answer, avoiding common omissions like indexes or constraints. Finally, asking for justification of design choices pushes the AI to reason about each decision rather than apply generic patterns.
Expected result
Variants by level
FAQ
Can ChatGPT generate a schema for any DBMS?
Does the generated schema respect normal forms?
How to integrate the generated schema into an existing project with an ORM?
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- Replace the bracketed variables with your details, then refine the result.
About Prompt Guide
Prompt Guide is a free library of 4800+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.
More prompts to explore
Prompt ChatGPT to Generate a Revision Plan
Preparing for exams or consolidating knowledge requires methodical organization that few students master spontaneously. ChatGPT proves to be a valuable ally...
Prompt ChatGPT to Generate SQL Queries
Generating SQL queries is an essential skill for any developer, data analyst, or database administrator. However, writing complex queries involving multiple joins, nested subqueries, or aggregate functions can be time-consuming and error-prone. ChatGPT radically transforms this practice by allowing you to describe your needs in natural language to obtain optimized and functional SQL queries in seconds.
Prompt ChatGPT to Prepare for an Interview
Preparing for a job interview is a decisive step in any job search. ChatGPT becomes a formidable ally for anticipating questions, structuring your answers, and building confidence before the big day.
Prompt Claude for Analyzing Customer Reviews
Analyzing customer reviews has become a strategic lever for any company looking to improve its products, services, and customer experience.
Prompt Claude for Analyzing Market Trends
Market trend analysis is a strategic exercise that requires cross-referencing economic, behavioral, and sectoral data to identify weak signals and underlying movements. Claude excels at this task thanks to its ability to synthesize large amounts of information, structure multi-dimensional analyses, and formulate well-argued hypotheses.
Prompt Claude for Automating Tasks
Task automation is one of the most powerful uses of Claude. Whether you are an entrepreneur, developer, or corporate professional, you waste considerable time each day on repetitive tasks: sorting emails, extracting data, generating reports, reformatting documents, or classifying information. Claude excels in these scenarios thanks to its ability to understand complex instructions, process structured data, and produce consistent results at scale. Unlike a rigid script, Claude adapts to format variations, handles edge cases, and can explain its decisions. By crafting a well-structured automation prompt, you turn Claude into an operational assistant capable of processing dozens of tasks in seconds with consistent quality. This guide provides optimized prompts to effectively delegate your recurring tasks to Claude, from raw data processing to formatted deliverable generation, including conditional decision-making on information flows.
Go further
Get new prompts every week
Join our newsletter.