Prompt Gemini for Generating 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. Gemini, Google's AI model, excels at generating database schemas thanks to its deep understanding of relational modeling principles, normal forms, and integrity constraints. By providing a structured prompt describing your business domain, main entities, and use cases, Gemini can produce a complete schema with tables, typed columns, primary keys, foreign keys, indexes, and constraints. Whether you work with PostgreSQL, MySQL, SQLite, or any other DBMS, Gemini adapts the generated SQL syntax to the target dialect. This approach significantly accelerates the design phase while adhering to modeling best practices, allowing you to move more quickly to application development.
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
You are a senior database architect specializing in relational modeling. Generate a complete database schema for an application of [DESCRIBE_YOUR_APPLICATION].
Business context:
- Domain: [e.g., e-commerce, project management, social network]
- Target users: [e.g., B2B companies, general public]
- Estimated volume: [e.g., 10,000 users, 1 million transactions/month]
Technical requirements:
- Target DBMS: [PostgreSQL / MySQL / SQLite]
- Include precise data types for each column
- Apply at least 3rd Normal Form (3NF)
- Add relevant NOT NULL, UNIQUE, CHECK constraints
- Define all primary and foreign keys with ON DELETE/ON UPDATE
- Propose necessary indexes for frequent queries
- Include audit columns (created_at, updated_at)
Expected output format:
- A textual diagram of relationships between entities
- A complete and executable SQL CREATE TABLE script
- A summary table of tables with their role
- Recommended indexes with justification
- SQL queries for the 5 most common operations
Personalize this prompt with Léa
Léa rewrites this prompt for your job and your exact goal — 3 quick questions.
Why this prompt works
This prompt works because it combines a precise expert role with explicit technical constraints that prevent Gemini from producing a generic or incomplete schema. Specifying the business context and data volume allows the model to tailor its choices of types and indexes. The structured output format with five deliverables forces a comprehensive and directly usable response.
Use Cases
Variants
Expected Output
Gemini produces a complete database schema including a textual entity-relationship diagram, ready-to-run SQL CREATE TABLE scripts with all types, constraints, and indexes, as well as an explanatory table for each table. You also get SQL queries for common operations, allowing you to immediately validate the schema's relevance for your real-world use cases.
Frequently Asked Questions
Can Gemini generate a schema for any database management system?
Yes, Gemini is proficient in the SQL syntax of most common DBMS: PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, and Oracle. Just specify the target DBMS in your prompt for Gemini to adapt data types (e.g., SERIAL vs AUTO_INCREMENT), native functions, and specific extensions. For NoSQL databases like MongoDB, Gemini can also generate collection schemas with JSON Schema validation.
How can I ensure the generated schema complies with normal forms?
Explicitly state the desired normalization level in your prompt (2NF, 3NF, BCNF). Also ask Gemini to justify its modeling choices and flag any intentional denormalization. You can add an instruction like "Verify that each table meets 3NF and explain any exceptions." This forces the model to analyze its own output and document the trade-offs between normalization and performance.
Can I provide an existing schema to Gemini for improvement or extension?
Absolutely. Paste your existing SQL script into the prompt and ask Gemini to analyze it, identify issues (unindexed columns, missing relationships, unsuitable types), and propose an improved version. This approach is especially useful for auditing a legacy database or adding new features to an existing schema while preserving compatibility with live data.
Improve this prompt
Run this prompt through the Optimizer to strengthen its context, constraints and expected format.
Improve this prompt with the OptimizerComments
- LéaAI
Pour des résultats plus précis, enrichissez le contexte métier avec des règles de gestion spécifiques (ex: un client ne peut avoir qu’une adresse principale). Cela améliorera les contraintes CHECK et les index générés. Utilisez ce prompt en phase de conception rapide pour un premier jet, toujours à valider avec un DBA.
📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Go further
Similar Prompts
Implement rate limiting
Protect APIs from abuse
Set up semantic versioning automation
Automate semantic versioning
Prompt DALL-E to Create a Prototype
Creating visual prototypes is a crucial step in any product design process. Traditionally reserved for designers with specialized tools like Figma or Sketch, this phase can now be accelerated with DALL-E. By generating realistic visual mockups from text descriptions, DALL-E allows entrepreneurs, product managers, and developers to quickly materialize their ideas without advanced graphic skills. Whether you want to visualize a mobile app interface, a physical product, or an architectural concept, DALL-E transforms your descriptions into compelling visual representations. This approach considerably reduces the time between ideation and the first visual iteration, going from several days to a few minutes. The AI-generated prototype then serves as a basis for discussion with stakeholders, investors, or potential users, facilitating the collection of concrete feedback before investing in costly development. Mastering the art of prompting for prototype generation with DALL-E thus becomes a strategic skill for anyone wishing to innovate quickly and effectively.
GitHub Copilot Prompt for Creating a REST API
GitHub Copilot has become an essential assistant for developers looking to accelerate the creation of REST APIs. Thanks to its direct integration into the code editor, it understands the context of your project and generates structured code in real time. Whether you work with Node.js and Express, Python and FastAPI, or Java and Spring Boot, Copilot adapts to your tech stack to produce endpoints conforming to REST conventions. The main challenge lies in formulating the prompt: a well-structured prompt yields a complete API with data validation, error handling, authentication, and documentation. A vague prompt, on the other hand, will produce generic code requiring many adjustments. In this guide, we offer an optimized prompt that fully leverages GitHub Copilot's capabilities to generate a professional, testable, production-ready REST API. You will also discover variants adapted to your experience level as well as practical tips to get the most out of this tool on a daily basis.