Banco de dadosSql
- (Colégio Pedro II 2017)
Considere o seguinte banco de dados:
Professor (Nome, Código, I.D., Salário) Aluno (Nome, Matrícula, Data-Nasc, Endereço) Disciplina (Nome, Código, Horas-Semanais) Leciona ( Código-Prof, Código-Discip) Matriculado-em ( Matrícula, Código-Discip, Nota)
Foram propostos os seguintes comandos em SQL para obter os dados do aluno (Tabela Aluno) que obteve a maior nota na disciplina de nome “Lógica”.
I. select * from aluno where matricula in (select matricula from matriculado_em where nota in (select MAX(nota)from matriculado_em where cod_disc in (select codigo from disciplina where nome = 'Lógica'))); II. select * from aluno where matricula in (select MAX(nota) from matriculado_em where cod_disc in (select codigo from disciplina where nome = 'Lógica')); III. selectaluno.* from aluno, matriculado_em where aluno.matricula=matriculado_em.matricula andnota in(select MAX(nota)from matriculado_em where cod_disc in(select codigo from disciplina where nome = 'Lógica')); IV. selectaluno.*, MAX(nota) from aluno, matriculado_em where cod_disc in( selectcodigo from disciplina where nome = 'Lógica')
Os comandos corretos são
A) I e III.
B) I e IV.
C) II e III.
D) II e IV.
Próximo:
EXERCÍCIOS - Exercício 107
Vamos para o Anterior: Exercício 105
Tente Este: Exercício 220
Primeiro: Exercício 1
VOLTAR ao índice: Banco de dados