Create Table 't1 '(
'Id' char (1) not null,
Primary Key ('id ')
) Engine = InnoDB default charset = gb2312
Create Table T2 (
Id char (1) not null,
Foreign key (ID) References T1 (ID)
);
Table T2 can be correctly created, but the foreign key is not created. Use show create table T2 to get the following: Create Table 't2 '(
'Id' char (1) not null,
Key 'id' ('id ')
) Engine = MyISAM default charset = gb2312
Certificate ------------------------------------------------------------------------------------------------------------------------------------------------
Create Table T2 (
Id char (1) not null,
Foreign key (ID) References T1 (ID)
) Engine = InnoDB charset = gb2312;
Use show create table T2 to get the following: Create Table 't2 '(
'Id' char (1) not null,
Key 'id' ('id '),
Constraint 't2 _ ibfk_1 'foreign key ('id') References 't1' ('id ')
) Engine = InnoDB default charset = gb2312