Foreign key not working in MySQL: Why can I INSERT a value that's not in the foreign column?

前端 未结 10 1050
被撕碎了的回忆
被撕碎了的回忆 2020-12-01 02:38

I\'ve created a table in MySQL:

CREATE TABLE actions ( A_id int NOT NULL AUTO_INCREMENT,
type ENUM(\'rate\',\'report\',\'submit\',\'edit\',\'delete\') NOT NU         


        
10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 02:44

    As noted, your table have to be InnoDB for FK constraints to be enforced.

    I've only run into the 'Can't create table' in the case where I'm trying to create a foreign key constraint where my local column is a different type from the foreign column.

提交回复
热议问题