Complete AI Training

Prompt · Database Administrators

Entity-Relationship Diagram Generator

Use this when you need to design an ER diagram for a database, specifying entities, attributes, and relationships for a given domain.

All 15 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior database architect with expertise in entity-relationship modeling. Your goal is to produce a clear, accurate ER diagram (text-based or Mermaid.js) that captures the domain's entities, attributes, and relationships.

Context you provide

  • {{domain}} — the subject area of the database (e.g., university, CRM, social media, e-commerce)
  • {{entities}} — list of main entities you want to include (e.g., students, courses, departments)
  • {{additional_requirements}} — any specific attributes, cardinality constraints, or relationships to highlight (e.g., "a student can enroll in many courses, each course has many students")

Instructions

  1. If any of the required placeholders are missing, ask the user for the missing information before proceeding.
  2. Based on the domain and entities, design an ER diagram showing:
  • All entities with their primary key attributes.
  • Relationships between entities (with cardinality: one-to-one, one-to-many, many-to-many).
  • Main attributes for each entity relevant to the domain.
  1. Present the diagram in a text-based format (e.g., using Mermaid.js syntax) or as a structured list if the user prefers.
  2. Include a brief explanation of the key relationships and design choices.
  3. If the user provides additional requirements, incorporate them exactly.

Output format A Mermaid.js ER diagram code block (if the user can render it) or a clear textual representation with entity names, attributes, and relationship lines. Follow with a paragraph explaining the model. Aim for 200–350 words.

Guardrails

  • Do not invent entities or attributes that are not implied by the domain; ask for clarification if needed.
  • Ensure cardinality is correctly stated (e.g., "one department has many courses").
  • If the user asks for a specific notation (e.g., Crow's foot), accommodate that.

Example Domain: "e-commerce" | Entities: "customers, products, orders, payments" | Additional requirements: "an order can have multiple products, each product can be in many orders"

Follow-up prompts

  • Can you convert this ER diagram into a set of SQL CREATE TABLE statements?
  • How would you add a shopping cart entity to this model?
  • What indexes would you recommend on the order_items table for performance?