MySQL - Ayuda con error 1452

 
Vista:

Ayuda con error 1452

Publicado por ana (2 intervenciones) el 16/12/2020 21:47:13
Buenas, nose pq me sale un error cuando quiero insertar valores en la tabla NOTA. Si alguien me puede ayudar se lo agradeceria.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
USE PARCIAL;
create table if not exists PROFESOR(
DNI int not null primary key,
APE varchar(10),
NOM varchar(10));
 
create table if not exists CURSO(CODIGO int primary key,DESCR varchar(10));
create table if not exists ALUMNO(LEGAJO int primary key,APE varchar(19),NOM varchar(10));
create table if not exists DICTA(
CODIGO int,
FECHAINI date,
DNI int,
FECHAFIN date NULL,
constraint fk_dicta primary key(CODIGO,FECHAINI),
constraint fk_cod foreign key (CODIGO) references CURSO(CODIGO)
);
 
create table if not exists INSCRIPTO(
CODIGO int,
FECHAINI date,
LEGAJO int,
constraint fk_INSCRIPTO primary key(CODIGO,FECHAINI,LEGAJO),
constraint fk_cod2 foreign key (CODIGO) references CURSO(CODIGO),
constraint fk_AL foreign key (LEGAJO) references ALUMNO(LEGAJO)
);
 
create table if not exists TIPOEXAMEN(
TIPO int not null primary key,
DESCR varchar(10));
 
create table if not exists CONDICION(
CODIGO int ,
FECHAINI date,
LEGAJO int ,
CONDICIONFINAL varchar(10),
constraint fk_CONDICION primary key(CODIGO,FECHAINI,LEGAJO),
constraint fk_cod5 foreign key (CODIGO) references CURSO(CODIGO),
constraint fk_AL3 foreign key (LEGAJO) references ALUMNO(LEGAJO)
);
 
create table if not exists NOTA(
CODIGO int,
FECHAINI date,
LEGAJO int ,
TIPO int,
NOTA int,
constraint fk_NOTA1 primary key(CODIGO,FECHAINI,LEGAJO,TIPO),
constraint fk_cod4 foreign key (CODIGO) references CURSO(CODIGO),
constraint fk_Al4 foreign key (LEGAJO) references ALUMNO(LEGAJO),
constraint fk_T4 foreign key (TIPO) references TIPOEXAMEN(TIPO)
);
 
 
insert NOTA  values (1,"2020/10/20",1,1,10);
insert NOTA  values (1,"2020/10/20",3,1,5);


ME SALE EL ERROR 1452 : Cannot add or update a child row: a foreign key constraint fails”
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder