Database Schema Designer
Design database schemas visually. Generate SQL CREATE TABLE statements. Common patterns for user systems, blogs, ecommerce.
Schema Patterns
User System: users, sessions, roles
Authentication and user management
Blog/CMS: users, posts, comments, categories
Content management system
Ecommerce: users, products, orders, cart, payments
Online store
Social: users, posts, likes, follows, messages
Social network features
SaaS: users, subscriptions, plans, usage, invoices
Subscription billing
Sample Tables
users
id INT PRIMARY KEY
email VARCHAR(255)
password VARCHAR(255)
created_at TIMESTAMP
posts
id INT PRIMARY KEY
user_id INT FOREIGN KEY
title VARCHAR(255)
content TEXT
created_at TIMESTAMP
Generated SQL
Common Column Types
INT
VARCHAR(255)
TEXT
BOOLEAN
TIMESTAMP
DATE
DECIMAL(10,2)
JSON
UUID
ENUM
Best Practices
Primary keys: use UUID or auto-increment INT. Foreign keys: always name clearly. Indexes: on foreign keys, search columns. Timestamps: created_at, updated_at on every table. Naming: lowercase, underscores. Avoid: reserved words, too many columns. Normalize: reduce redundancy. Denormalize: for read performance.
Relationship Types
One-to-One: user → profile
One-to-Many: user → posts
Many-to-Many: users ↔ roles (join table)
Self-Reference: user → manager_id