Foreign Key Generator
Generate MySQL foreign key constraint statements, define relationships between tables
📖 User Guide Click to view detailed usage instructions
Collapse Expand
📖 User Guide
Click to view detailed usage instructions
Foreign Key Generator
Free online tool to generate MySQL database foreign key constraint statements. Define relationships between tables.
Features
- Custom foreign key name support
- Support multiple cascade actions (CASCADE, SET NULL, RESTRICT, NO ACTION)
- Auto-generate constraint names
- One-click copy generated SQL
How to Use
- Enter child table name and child field
- Enter parent table name and parent field
- Select cascade actions for DELETE and UPDATE
- Click "Generate Foreign Key" button
- Copy and execute the generated SQL
Use Cases
- Database table relationship design
- Maintain data integrity
- Create related table structures