Last active
December 19, 2015 03:49
-
-
Save cesg/5893103 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2 | |
alter table session | |
add constraint fk_session_evento | |
foreign key (cod_evento) references `evento`(cod_evento) | |
on delete restrict on update restrict; | |
alter table session | |
add constraint fk_session_periodo | |
foreign key (num_periodo) references `periodo`(num_periodo) | |
on delete restrict on update restrict; | |
alter table session | |
add constraint fk_session_lugar | |
foreign key (cod_lugar) references `lugar`(cod_lugar) | |
on delete restrict on update restrict; | |
# 7 | |
delete from inscrito i | |
inner join evento e on (i.cod_evento = e.cod_evento) | |
where e.cod_evento = 42; | |
# 24 | |
select c.cod_carrera, c.nom_carrera,a.nom_alumno, a.matricula, e.des_evento | |
from alumno a | |
inner join carrera c on (a.cod_carrera = c.cod_carrera) | |
inner join participante p on (a.matricula = p.matricula) | |
inner join session s on (p.cod_evento = s.cod_evento and p.correlativo = s.correlativo) | |
inner join evento e on (s.cod_evento = e.cod_evento) | |
where p.ganador = 'si' and s.des_sesion = 'final' | |
order by c.nom_carrera,a.nom_alumno,e.des_evento; | |
# 12 | |
select distinct c.cod_carrera, c.nom_carrera | |
from carrera c | |
inner join alumno a on (c.cod_carrera = a.cod_carrera) | |
inner join inscrito i on (c.matricula = i.matricula) | |
inner join evento e on (i.cod_evento = e.cod_evento) | |
inner join session s on (e.cod_evento = s.cod_evento) | |
inner join lugar l on (s.cod_lugar = l.cod_lugar) | |
where l.des_lugar ='Gimnasio techado N° 1' | |
order by a.nom_alumno; | |
# 17 | |
select distinct l.cod_lugar,l.des_lugar | |
from lugar l | |
inner join sesion s on (l.cod_lugar = s.cod_lugar) | |
inner join evento e on (s.cod_evento = e.cod_evento) | |
inner join tipo_activ ta on (e.cod_tipactiv = ta.cod_tipactiv) | |
where ta.des_tipactiv = 'deportiva'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment