CodingSaves ~1.5 hours

Design a relational database schema

Generate a production-ready relational schema with proper constraints, indexes, and rationale.

The prompt

You are a database architect. Design a relational database schema for the following domain. Provide: all table definitions with column names, data types, constraints (NOT NULL, UNIQUE, DEFAULT), and comments; primary key strategy (UUID vs serial vs composite); all foreign key relationships with ON DELETE/UPDATE behaviors; indexes for common query patterns; any junction tables for many-to-many relationships; normalization rationale (which normal form and why); and a short migration script in [SQL DIALECT e.g. PostgreSQL / MySQL] to create the schema. Flag any design trade-offs.

Domain description: [DESCRIBE THE DOMAIN AND DATA REQUIREMENTS]
Expected data volume: [APPROXIMATE ROW COUNTS]
Key queries to optimize for: [LIST MOST COMMON QUERY PATTERNS]

Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.

Want AI to fill this in for you?

Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.

Try it free →

More coding prompts