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.

Best For

  • Founders scoping a new SaaS product who need a normalized schema before writing any backend code.
  • Backend developers documenting a schema for a spec review who want SQL plus a plain-English ER summary in one pass.
  • Teams evaluating build tradeoffs who want design decisions and their rationale called out explicitly.

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.

Pro Tip

List every core use case the app must support, including reporting or admin queries, since schemas designed only around the primary user flow tend to miss the indexes admin dashboards need later.

Example Output

A sample of what this prompt produces once you fill in the placeholders.

For a project management tool supporting tasks, projects, and team assignment, the output provides CREATE TABLE statements for projects, tasks, users, and a project_members junction table, indexes on tasks.project_id and tasks.due_date, an ER summary describing the many-to-many between users and projects, and a flagged tradeoff around whether to soft-delete or hard-delete completed projects.

Recommended Tools

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.