MySQL error cannot add foreign key constraint

后端 未结 6 1625
既然无缘
既然无缘 2021-01-14 01:52

what is wrong?

mysql> create table price(
    -> p_code char(1) not null,
    -> p_description varchar(20),
    -> p_rentfee decimal(2,2) not nul         


        
6条回答
  •  说谎
    说谎 (楼主)
    2021-01-14 02:33

    1. The referenced column price.p_code must be unique (primary or unique key need to be created).
    2. Both tables must be InnoDb tables, use ENGINE = INNODB in CREATE TABLE statement.

提交回复
热议问题