Todos los ejemplos

Ejemplos

Seguimiento de una consulta SQL, cláusula por cláusula

FROM, WHERE, ORDER BY y SELECT aplicados en el orden en que SQL los ejecuta, sobre una pequeña tabla de notas de estudiantes.

  • 0:55
  • Problemas de código
  • Narrado por Erinome
  • Inglés

Hecho a partir de un prompt

Trace this on students(name, marks) with Asha 92, Ravi 78, Meera 85: SELECT name FROM students WHERE marks > 80 ORDER BY marks DESC;

Transcripción del video

In this video, we trace an SQL query that filters and sorts student records.

Question one: SQL tracing. Trace this on students, name and marks, with Asha ninety-two, Ravi seventy-eight, Meera eighty-five.

FROM students reads the three rows. WHERE marks greater than eighty keeps only rows whose marks exceed eighty. Asha has ninety-two marks, so Asha stays.

Ravi has seventy-eight marks, so Ravi is excluded. Meera has eighty-five marks, so Meera stays. ORDER BY marks DESC sorts the remaining rows by marks, highest first.

Ninety-two comes before eighty-five, so Asha comes before Meera. SELECT name returns only the names, not the marks. Notice that sorting by marks does not require displaying marks.

Hence, the output is Asha followed by Meera.

Tu tema, dibujado en un minuto, más o menos.

Tus primeros 2 videos son gratis, de hasta 1 minuto cada uno, con marca de agua. No necesitas tarjeta. Producto completo, con todas las voces y estilos incluidos.