简体   繁体   English

如果引擎是MyISAM,则表中没有外键

[英]no foreign key in table if engine is MyISAM

why i cannot create foreign key in my table payments. 为什么我不能在表付款中创建外键。

crate table students(
text char(5)NOT NULL,
id int(11)NOT NULL AUTO_INCREMENT,
name varchar(250),
level varchar(250),
PRIMARY KEY (text,id)
)ENGINE=MyISAM;

the oder table is oder表是

 crate table payments(
    p_id int(11)NOT NULL AUTO_INCREMENT,
    amount varchar(250),
    id int
    PRIMARY KEY (p_id)
FOREIGN KEY (id) REFERENCES students(id)
    )ENGINE=MyISAM;

Because MyISAM does not support foreign keys. 因为MyISAM不支持外键。 The FK declarations are parsed, but otherwise ignored. FK声明被解析,但否则被忽略。 You need to use InnoDB tables for real FK support. 您需要使用InnoDB表以获得真正的FK支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM