SQL Database Schema Template

Generate a complete SQL database schema with tables, relationships, and indexes

6/11/2026
Prompt
Create a SQL database schema for:

Application Type: {{APPLICATION_TYPE}} (e.g., e-commerce, SaaS, social media)
Database Engine: {{DATABASE_ENGINE}} (PostgreSQL/MySQL/SQLite)
Features Required: {{FEATURES}}

Generate complete schema including:

1. **Core Tables:**
   - Primary key strategies (UUID vs auto-increment)
   - Created/updated timestamps
   - Soft delete columns
   - Audit fields

2. **Relationship Tables:**
   - One-to-many relationships
   - Many-to-many junction tables
   - Self-referential relationships
   - Polymorphic associations

3. **Data Integrity:**
   - Foreign key constraints
   - Check constraints
   - Unique constraints
   - Not null constraints
   - Default values

4. **Indexes:**
   - Primary key indexes
   - Foreign key indexes
   - Composite indexes for common queries
   - Partial indexes where applicable
   - Full-text search indexes

5. **Views:**
   - Common query views
   - Materialized views for reporting
   - Security views (row-level)

6. **Functions/Procedures:**
   - Timestamp update triggers
   - Audit logging triggers
   - Data validation functions

7. **Sample Data:**
   - Seed data scripts
   - Test data generation

Include migration scripts for version control.

Or press ⌘C to copy

Variables (3)

Replace these placeholders with your own content before using the prompt.

[{APPLICATION_TYPE][{DATABASE_ENGINE][{FEATURES]

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...