Back to Prompt Library
Coding
databaseschemaSQLPostgreSQLdata modelingbackend

Database Schema Designer

A production-ready relational database schema with SQL CREATE statements, indexes, and a clear ER summary.

Prompt Template

Design a relational database schema for [PROJECT_DESCRIPTION]. The system must support the following core use cases: [USE_CASE_LIST]. Use [DATABASE_TYPE — e.g., PostgreSQL, MySQL] conventions. For each table, specify: table name, all columns with data types and constraints (PRIMARY KEY, NOT NULL, UNIQUE, FOREIGN KEY), and a brief comment explaining the table's purpose. Define all foreign key relationships and indicate whether each is one-to-one, one-to-many, or many-to-many. Include appropriate indexes for columns that will be frequently filtered or joined. Identify any junction tables needed for many-to-many relationships. Output the schema as valid SQL CREATE TABLE statements followed by a plain-English Entity-Relationship summary. Flag any design decisions that involve trade-offs and explain your rationale.

How to use this prompt

  1. Copy the prompt template using the button above.
  2. Paste it into your preferred AI assistant (ChatGPT, Claude, Gemini, etc.).
  3. Replace all bracketed placeholders like [TOPIC] with your specific details.
  4. Send the prompt and refine the output as needed.
Advertisement