Good afternoon guys, could anyone help me? My foreign key is not working in a database. I had already done a foreign key in another database the same way, but now it is not working for no apparent reason. I already changed the engine to INNODB, I already tried an alter table, but nothing ...
Follow the tables:
**Tabela cargos:**
create table cargos
(
cod_cargo int auto_increment primary key,
nome_cargo varchar(45)
)
**Tabela funcionarios:**
create table Funcionarios
(
cracha int AUTO_INCREMENT PRIMARY KEY,
nome varchar(50),
sobrenome varchar(50),
email varchar(50),
senha varchar(20),
cpf varchar(14),
data_de_nascimento varchar(10),
sexo char(1),
cidade varchar(35),
tel_fixo char(13),
tel_movel char(14),
foto varchar(50),
cargo_funcionario int,
salario decimal (8,2),
observacoes text,
foreign key (cargo_funcionario) references cargos(cod_cargo)
)