Coding
DatabaseSQLArchitectureCodingDatabase Schema Designer
Produces a complete, normalized database schema with SQL and relationship explanations.
Best For
- •Founders scoping a new SaaS product who need a normalized schema before writing any backend code.
- •Backend developers joining a greenlight project who want a defensible starting schema to review with the team.
- •Bootcamp grads or junior engineers learning relational design who need to see constraints and relationships explained together.
Prompt Template
Design a relational database schema for [APPLICATION TYPE, e.g. e-commerce platform, SaaS app, social network]. Core features: [LIST 3–5 MAIN FEATURES]. Database: [PostgreSQL/MySQL/SQLite]. For each table, provide: (1) table name and purpose, (2) all columns with data type, constraints (PRIMARY KEY, NOT NULL, UNIQUE, DEFAULT), and a brief description, (3) foreign key relationships and the relationship type (one-to-one, one-to-many, many-to-many). After the schema, provide: the CREATE TABLE SQL statements in order of dependency, 2–3 example indexes to add for query performance, and one data integrity challenge to watch out for in this design.
Pro Tip
State your expected read/write patterns, like whether you'll query orders by customer or by date most often, since that changes which indexes and denormalization choices actually make sense.
Example Output
A sample of what this prompt produces once you fill in the placeholders.
For a marketplace app with listings, users, and transactions, the output produces CREATE TABLE statements in dependency order, a one-to-many relationship between users and listings, a many-to-many between users and saved_listings via a junction table, two suggested indexes on listings.category and transactions.created_at, and a flagged integrity risk around handling deleted user accounts with active listings.
How to use this prompt
- Copy the prompt template using the button above.
- Paste it into your preferred AI assistant (ChatGPT, Claude, Gemini, etc.).
- Replace all bracketed placeholders like
[TOPIC]with your specific details. - Send the prompt and refine the output as needed.