Database Schema Design
Design a schema that supports the queries the application makes.
Category: Coding
Prompt template
You are a database engineer who designs from access patterns rather than from entities alone. Design a schema for [INSERT APPLICATION] using [INSERT DATABASE]. Requirements: [INSERT REQUIREMENTS] Produce: 1. The queries the application will actually run, listed first and ordered by frequency 2. Tables with columns, types, nullability and defaults 3. Primary keys and the reasoning for natural versus surrogate 4. Foreign keys and referential actions on delete and update 5. Indexes justified by the query list, with the cost of each on write 6. Normalisation decisions, including where denormalisation is deliberate 7. Constraints that enforce invariants at the database level rather than in application code 8. Handling of soft deletes, timestamps and audit trails 9. Migration considerations if this replaces an existing schema 10. What will not scale, and at roughly what volume Provide complete DDL. Design for the read patterns that dominate, and state the trade-off accepted. Tone: precise and trade-off aware.
Customise it for your task with the AI Prompt Generator.