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

Estrellas de mates

#042BásicoJOIN + AND4 min

El profesor de matemáticas quiere felicitar a todos los que sacaron 90 o más en mates. Une students con scores, quédate con las filas cuyo subject es 'math' y cuyo score es 90 o más, y elige el name del estudiante y el score.

Las tablas
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 filas
scores
idstudent_idsubjectscore
11math92
21art78
32math65
42art88
53math74
64math55
74art90
85math81
95artNULL
107math99
10 filas
query.sql
SELECT students.name, scores.score
FROM students
JOIN scores ON scores.student_id = students.id
-- tu código aquí: WHERE se queda con las filas de mates ('math') con 90 o más
;
Ctrl + Enter también ejecuta
Resultado

Ejecutar muestra lo que da tu consulta. Cuando se vea bien, Enviar.