Aan de slagGa gratis aan de slag

Queries with derived tables (II)

In this exercise, you will create a derived table to return all patient records with the highest BloodPressure at their Age level.```

```

Deze oefening maakt deel uit van de cursus

Intermediate SQL Server

Cursus bekijken

Oefeninstructies

  • Create a derived table
    • returning Age and MaxBloodPressure; the latter is the maximum of BloodPressure.
    • is taken from the kidney table.
    • is grouped by Age.
  • Join the derived table to the main query on
    • blood pressure equal to max blood pressure.
    • age.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT *
FROM Kidney a
-- Create derived table: select age, max blood pressure from kidney grouped by age
JOIN (___) b
-- JOIN on BloodPressure equal to MaxBloodPressure
ON ___
-- Join on Age
AND ___
Code bewerken en uitvoeren