Kodewick
Comece a aprender →
Básico←→0 / 70

Craques da matemática

#042BásicoJOIN + AND4 min

O professor de matemática quer elogiar todo mundo que tirou 90 ou mais em matemática. Junte students com scores, fique com as linhas cujo subject é 'math' e score é 90 ou mais, e escolha o name do aluno e o score.

As tabelas
students
  • idPK
  • name
  • class
  • age
  • city
scores
  • idPK
  • student_idFK
  • subject
  • score

scores.student_id → students.id

students
idnameclassagecity
1Amy1A12Leeds
2Ben1A13York
3Cara1B12NULL
4Dan1B14Leeds
5Eva1A12Hull
6Finn1C13NULL
7Gus1C12York
7 linhas
scores
idstudent_idsubjectscore
11math92
21art78
32math65
42art88
53math74
64math55
74art90
85math81
95artNULL
107math99
10 linhas
query.sql
SELECT students.name, scores.score
FROM students
JOIN scores ON scores.student_id = students.id
-- seu código aqui: WHERE fica com as linhas de matemática ('math') com 90 ou mais
;
Ctrl + Enter também executa
Resultado

Executar mostra o que sua consulta devolve. Quando parecer certo, Enviar.