Database schema design from app requirements

A ChatGPT prompt for database schema design: tables, keys, relationships, indexes and SQL DDL from plain-English requirements, with trade-offs explained.

Published
Works with
ChatGPT, Claude and Gemini
Level
Advanced
By
GoodAIPromt editorial team

A weak database schema causes slow queries, messy data and painful migrations later. This prompt turns plain-English app requirements into a relational schema: entities, keys, relationships, constraints and indexes, with the SQL to create it and the trade-offs explained, so you can review the design before writing any code.

The prompt

Act as a senior backend engineer. Design a database schema.

What the app does: 
Main things it stores and how they relate: [ENTITIES AND RELATIONSHIPS, e.g. users have many orders, orders have many items]
Most common queries and writes: 
Expected scale: [SCALE, e.g. 10k users, 1M rows per month]
Database: [DATABASE, e.g. PostgreSQL, MySQL, SQLite]
Special needs: [NEEDS, e.g. soft deletes, multi-tenant, audit history, time zones]

Give me:
1. An entity list with fields, types, nullability and constraints.
2. Relationships with cardinality, and an ER diagram in Mermaid syntax.
3. CREATE TABLE statements with primary keys, foreign keys, unique constraints and sensible defaults.
4. Indexes based on the key queries, with why each one is needed.
5. Design trade-offs (normalization vs. speed, enums vs. lookup tables, IDs) and what I'd change at 10× scale.
6. Example queries for the 3 most common operations.
Ask about anything ambiguous before assuming.

0 of 2 blanks filled

How to use it

  1. List your real queries; indexes should follow how the app reads data.
  2. Review the ER diagram with your team before writing migrations.
  3. Test with realistic data volumes before launch.

Tips

Frequently asked questions

What does this prompt do?

A ChatGPT prompt for database schema design: tables, keys, relationships, indexes and SQL DDL from plain-English requirements, with trade-offs explained.

Which AI tools does it work with?

It is written for ChatGPT, Claude and Gemini. It also works in other AI tools that accept text prompts, with small changes.

What do I need to fill in?

2 blanks: app description; key queries. Click each blue blank on the page, type your details and press Copy prompt.

Is this prompt free to use?

Yes. You can copy and use it for personal and commercial work.

database designsqlschemabackend

More prompts for ChatGPT, Claude, Gemini.