Im trying to insert values on this table using "insert into", but there is this error: "Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (TESTE.FUNCIONARIO, CONSTRAINT FUNCIONARIO_ibfk_1 FOREIGN KEY (CPF_SUPERVISOR) REFERENCES FUNCIONARIO (CPF))".
I cant find what is causing it.
This is the SHOW CREATE TABLE:
CREATE TABLE FUNCIONARIO (
PNOME varchar(10) DEFAULT NULL,
MINICIAL char(1) DEFAULT NULL,
UNOME varchar(10) DEFAULT NULL,
CPF varchar(11) NOT NULL,
DATANASC date DEFAULT NULL,
ENDERECO varchar(100) DEFAULT NULL, SEXO char(1) DEFAULT NULL,
SALARIO decimal(10,0) DEFAULT NULL,
CPF_SUPERVISOR varchar(11) NOT NULL,
DNR int DEFAULT NULL,
PRIMARY KEY (CPF),
KEY CPF_SUPERVISOR (CPF_SUPERVISOR),
KEY DNR (DNR),
CONSTRAINT FUNCIONARIO_ibfk_1 FOREIGN KEY (CPF_SUPERVISOR) REFERENCES FUNCIONARIO (CPF),
CONSTRAINT FUNCIONARIO_ibfk_2 FOREIGN KEY (DNR) REFERENCES DEPARTAMENTO (DNUMERO)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Anyone know what could be happening?