MySQL error 1022 when creating table

前端 未结 3 2074
南方客
南方客 2020-11-29 13:16

MySQL Workbench came up with the following SQL to create a table:

CREATE  TABLE IF NOT EXISTS `mydb`.`errors_reports` (
   `error_id` INT NOT NULL ,
   `repo         


        
3条回答
  •  情书的邮戳
    2020-11-29 13:31

    The problem is that the name of a foreign key can not be the same as another foreign key in the entire model.

    Imagine this situation

    Catalog --> Supplier

    Product --> Supplier

    if the name of the foreign key in table Catalog for supplier is "supplier" and you assigned the same name in product table then the foreign keys names will "collide".

    You need to name them differently..

    For example:

    catalog_supplier product_supplier

提交回复
热议问题