I'm having an error in the creation of a table, I'm getting the error of MySQL 1215
-
Already check the data types
-
The name is the same
The creation of the users table is the following:
create table if not exists usuarios ( -- listo
idusuarios INT not null auto_increment,
documento INT not null,
nombre varchar(45),
apellido varchar(45),
email varchar(45),
observaciones varchar(90),
natalicio varchar(45),
estado char(1),
domicilio varchar(45),
primary key (idusuarios,documento)
)
engine=innodb;
The creation of the charges table is as follows:
create table cargos(
idCargos int not null auto_increment primary key,
nombre varchar(30) not null,
estado char(1),
descripcion varchar(45),
observaciones varchar(90) null default null
)engine=innodb;
And the creation of the employeesCargos table is as follows:
create table if not exists empleadosCargos(
Documento INT not null,
idCargos INT not null,
idUsuarios int not null,
foreign key (Documento,idUsuarios) references usuarios(documento,idusuarios),
foreign key (idCargos) references cargos(idcargos)
)engine=InnoDB;
This is the image of the error:
Thanks in advance. Greetings!