views:

490

answers:

2

I'm try to create a foreign key between tables by using MySQL Workbench. But I don't know why I can't tick the checkbox to select a field in order to map with another field in another table. Maybe it require both field has the same type (and other conditions??) So can you tell me the criteria to create relationship using foreign key and how to do it in MySQL Workbench? Thank you

A: 

I'm not a user of MySQL Workbench, but make sure you're using a storage engine that supports foreign keys in the first place. (for example, InnoDB)

See the MySQL documentation for the requirements necessary for a foreign key relationship.

RC
Oh yeah, I can see the problem. I set the difference collation for two field. I revised, using one consistent collation and now I can make the relation.Thank you
Thang Nguyen
A: 

Try first to create a table. And then to add foreign key.

duchev