I'm starting my journey in programming and I came across a mistake in creating the MySQL database:
1005 - Can not create table 'mydb.provider' (errno: 150)
What will it be? I have already logged into several forums but this same error message appears for various types of errors in MySQL and I still can not identify the error that is being presented.
The script:
-- -----------------------------------------------------
-- Table 'mydb'.'fornecedor'
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS 'mydb'.'fornecedor' (
'id_fornecedor' INT NOT NULL AUTO_INCREMENT ,
'id_observ_fornecedor' INT NOT NULL ,
'nome_fan' VARCHAR(45) NULL ,
'razao_social' VARCHAR(45) NULL ,
'cnpj' CHAR(15) NULL ,
'fone1' CHAR(11) NULL ,
'fone2' CHAR(11) NULL ,
'fone3' CHAR(11) NULL ,
'fone4' CHAR(11) NULL ,
'email1' VARCHAR(45) NULL ,
'email2' VARCHAR(45) NULL ,
'email3' VARCHAR(45) NULL ,
'endereco' VARCHAR(45) NULL ,
'ramo_atuacao' VARCHAR(45) NULL ,
'forn_desd' DATE NULL ,
'criado_por' INT NULL ,
'criado_data' DATETIME NULL ,
'alterado_por' INT NULL ,
'alterado_data' DATETIME NULL ,
'deletado_por' INT NULL ,
'deletado_data' DATETIME NULL ,
PRIMARY KEY ('id_fornecedor', 'id_observ_fornecedor') ,
INDEX 'fornecedor_id_observ_idx' ('id_observ_fornecedor' ASC) ,
INDEX 'fk_fornecedor_lista_cot_forn' ('id_fornecedor' ASC) ,
CONSTRAINT 'fk_id_observ'
FOREIGN KEY ('id_observ_fornecedor' )
REFERENCES 'mydb'.'observ' ('id_observ' )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT 'fk_fornecedor_lista_cot_forn'
FOREIGN KEY ('id_fornecedor' )
REFERENCES 'mydb'.'lista_cot_forn' ('id_fornecedor_lista_cot_forn' )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;