Alle Beispiele

Beispiele

Eine SQL-Abfrage nachverfolgen, Klausel für Klausel

FROM, WHERE, ORDER BY und SELECT auf eine kleine Tabelle mit Punktzahlen von Schülern angewendet, in der Reihenfolge, in der SQL sie ausführt.

  • 0:55
  • Code-Aufgaben
  • Gesprochen von Erinome
  • Englisch

Aus einem Prompt erstellt

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

Transkript zum 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.

Dein Thema, gezeichnet in etwa einer Minute.

Deine ersten 2 Videos sind kostenlos, je bis zu 1 Minute lang, mit Wasserzeichen. Keine Kreditkarte nötig. Das komplette Produkt, inklusive aller Stimmen und Stile.