Merge pull request #25 from cromerc/arreglar_relaciones

Arreglar relaciones
This commit is contained in:
HieloxZack 2020-07-16 19:27:47 -04:00 committed by GitHub
commit 23a3e09fc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 2 deletions

View File

@ -1,5 +1,5 @@
INSERT INTO MEDALLA (DESCRIPCION) VALUES ('oro');
INSERT INTO MEDALLA (DESCRIPCION) VALUES ('plata ');
INSERT INTO MEDALLA (DESCRIPCION) VALUES ('plata');
INSERT INTO MEDALLA (DESCRIPCION) VALUES ('bronce');
INSERT INTO CATEGORIA (DESCRIPCION) VALUES ('100 Metros');
@ -120,3 +120,14 @@ INSERT INTO PARTICIPAR_PRECOMPETENCIA (ID_PRECOMPETENCIA, ID_ATLETA, PUNTAJE, FE
INSERT INTO PARTICIPAR_COMPETENCIA (ID_COMPETENCIA, ID_ATLETA, FECHA) VALUES (1, 1, TO_DATE('2020-06-06 00:00:00', 'YYYY-MM-DD HH24:MI:SS'));
INSERT INTO PARTICIPAR_COMPETENCIA (ID_COMPETENCIA, ID_ATLETA, FECHA) VALUES (1, 2, TO_DATE('2020-06-06 00:00:00', 'YYYY-MM-DD HH24:MI:SS'));
INSERT INTO PARTICIPAR_COMPETENCIA (ID_COMPETENCIA, ID_ATLETA, FECHA) VALUES (1, 3, TO_DATE('2020-06-06 00:00:00', 'YYYY-MM-DD HH24:MI:SS'));
INSERT INTO PERTENECER (ID_DELEGACION, ID_PAIS) VALUES (1, 1);
INSERT INTO PERTENECER (ID_DELEGACION, ID_PAIS) VALUES (2, 2);
INSERT INTO PERTENECER (ID_DELEGACION, ID_PAIS) VALUES (3, 3);
INSERT INTO PERTENECER (ID_DELEGACION, ID_PAIS) VALUES (4, 4);
INSERT INTO COMPETER_POR (ID_ATLETA, ID_DELEGACION) VALUES (1, 1);
INSERT INTO COMPETER_POR (ID_ATLETA, ID_DELEGACION) VALUES (2, 1);
INSERT INTO COMPETER_POR (ID_ATLETA, ID_DELEGACION) VALUES (3, 2);
INSERT INTO COMPETER_POR (ID_ATLETA, ID_DELEGACION) VALUES (4, 3);
INSERT INTO COMPETER_POR (ID_ATLETA, ID_DELEGACION) VALUES (5, 4);

View File

@ -14,4 +14,6 @@ DROP TABLE PAIS;
DROP TABLE ATLETA;
DROP TABLE CATEGORIA;
DROP TABLE MEDALLA;
DROP TABLE PERTENECER;
DROP TABLE COMPETER_POR;
PURGE RECYCLEBIN;

View File

@ -142,7 +142,13 @@ GANAR (\underline{\textbf{ID\_ATLETA}, \textbf{ID\_COMPETENCIA}, FECHA}, \textbf
PARTICIPAR\_COMPETENCIA (\underline{\textbf{ID\_COMPETENCIA}, \textbf{ID\_ATLETA}, FECHA})\bigskip
\noindent
PARTICIPAR\_PRECOMPETENCIA (\underline{\textbf{ID\_PRECOMPETENCIA}, \textbf{ID\_ATLETA}, FECHA}, PUNTAJE)
PARTICIPAR\_PRECOMPETENCIA (\underline{\textbf{ID\_PRECOMPETENCIA}, \textbf{ID\_ATLETA}, FECHA}, PUNTAJE)\bigskip
\noindent
PERTENECER (\underline{\textbf{ID\_DELEGACION}, \textbf{ID\_PAIS}})\bigskip
\noindent
COMPETER\_POR (\underline{\textbf{ID\_ATLETA}, \textbf{ID\_DELEGACION}})
}
\newpage

View File

@ -139,3 +139,19 @@ CREATE TABLE PARTICIPAR_PRECOMPETENCIA(
CONSTRAINT PARTICIPAR_PRECOMPETENCIA_PRECOMPETENCIA_FK FOREIGN KEY (ID_PRECOMPETENCIA) REFERENCES PRECOMPETENCIA(ID_PRECOMPETENCIA),
CONSTRAINT PARTICIPAR_PRECOMPETENCIA_ATLETA_FK FOREIGN KEY (ID_ATLETA) REFERENCES ATLETA(ID_ATLETA)
);
CREATE TABLE PERTENECER(
ID_DELEGACION NUMBER,
ID_PAIS NUMBER,
CONSTRAINT PERTENECER_PK PRIMARY KEY (ID_DELEGACION, ID_PAIS),
CONSTRAINT PERTENECER_DELEGACION_FK FOREIGN KEY (ID_DELEGACION) REFERENCES DELEGACION(ID_DELEGACION),
CONSTRAINT PERTENECER_PAIS_FK FOREIGN KEY (ID_PAIS) REFERENCES PAIS(ID_PAIS)
);
CREATE TABLE COMPETER_POR(
ID_ATLETA NUMBER,
ID_DELEGACION NUMBER,
CONSTRAINT COMPETER_POR_PK PRIMARY KEY (ID_ATLETA, ID_DELEGACION),
CONSTRAINT COMPETER_POR_ATLETA_FK FOREIGN KEY (ID_ATLETA) REFERENCES ATLETA(ID_ATLETA),
CONSTRAINT COMPETER_POR_DELEGACION_FK FOREIGN KEY (ID_DELEGACION) REFERENCES DELEGACION(ID_DELEGACION)
);