Você está na página 1de 3

INSTITUTO FEDERAL DE EDUCAO, CINCIA E TECNOLOGIA DO TOCANTINS

CAMPUS ARAGUATINS-TO
COORDENAO DE ENSINO SUPERIOR / CES
COORDENAO DE COMPUTAO
CURSO DE LICENCIATURA EM COMPUTAO
BANCOS DE DADOS II

VITOR MENDES VILAS BOAS

ATIVIDADE AVALIATIVA
RELATRIOS SQL UTILIZANDO O QUERY BUILDER

Araguatins
2013
1

1 TABELAS CRIADAS NO ORACLE

2 RELATRIOS

2.1 Selecione os alunos cadastrados


select ALU_NOME as " Nome do Aluno" from TRAB_ALUNOS

2.2 Selecione os alunos do curso


TODOS OS CURSOS:
select CUR_NOME as " Nome do Curso ", ALU_NOME as " Nome do Aluno"
from TRAB_ALUNOS_DO_CURSO,TRAB_CURSOS,TRAB_ALUNOS
where AC_CUR_CODIGO=CUR_CODIGO and AC_ALU_CODIGO=ALU_CODIGO
ORDER BY CUR_NOME

CURSO ESPECFICO:
select CUR_NOME as "Nome do Curso", ALU_NOME as "Nome do Aluno"
from TRAB_ALUNOS_DO_CURSO,TRAB_CURSOS,TRAB_ALUNOS
where AC_CUR_CODIGO=CUR_CODIGO and AC_ALU_CODIGO=ALU_CODIGO
and CUR_CODIGO=1 ORDER BY ALU_NOME

2.3 Selecione os cursos que o aluno esta matriculado


select ALU_NOME as "Aluno",CUR_NOME as "Curso"
from TRAB_ALUNOS, TRAB_CURSOS, TRAB_ALUNOS_DO_CURSO
where AC_ALU_CODIGO=ALU_CODIGO and CUR_CODIGO=AC_CUR_CODIGO and
ALU_CODIGO=10 ORDER BY CUR_NOME
2.4 Quantos alunos matriculados
select count(AC_ALU_CODIGO) as "N de Matriculas" from TRAB_ALUNOS_DO_CURSO

2.5 Quantos alunos existem no curso


select CUR_NOME as "Curso",count(AC_CUR_CODIGO) as "N de Alunos"
from TRAB_CURSOS,TRAB_ALUNOS_DO_CURSO where
AC_CUR_CODIGO=CUR_CODIGO group by CUR_NOME ORDER BY CUR_NOME

2.6 Em quantos cursos o aluno est matriculado


select ALU_NOME as "Nome do Aluno", count(AC_ALU_CODIGO) as "N de Cursos"
from TRAB_CURSOS,TRAB_ALUNOS_DO_CURSO,TRAB_ALUNOS
where AC_CUR_CODIGO=CUR_CODIGO and AC_ALU_CODIGO=ALU_CODIGO
group by ALU_NOME ORDER BY ALU_NOME

2.7 Quantos alunos por cidade

select CID_NOME as "Cidade", count(ALU_CID_CODIGO) as "N de alunos"


from TRAB_ALUNOS,TRAB_CIDADES where CID_CODIGO=ALU_CID_CODIGO
group by CID_NOME order by CID_NOME

Você também pode gostar