SQL Taskbook Level 8.5
The tables are given:
| id | name | date_of_birth |
|---|---|---|
| 1 | John | 2000-12-25 |
| 2 | Matthew | 1999-01-30 |
| 3 | Martin | 1998-10-20 |
| 4 | Oscar | 2000-04-30 |
| 5 | Ricola | 2000-05-31 |
| id | student_id | subject_id | grade |
|---|---|---|---|
| 1 | 4 | 1 | 9.8 |
| 2 | 3 | 1 | 6.5 |
| 3 | 5 | 1 | 7.5 |
| 4 | 1 | 1 | 7.7 |
| 5 | 2 | 1 | 8.6 |
| 6 | 5 | 2 | 6.7 |
| 7 | 4 | 2 | 9.1 |
| 8 | 3 | 2 | 9.5 |
| 9 | 2 | 2 | 8.0 |
| 10 | 1 | 2 | 5.4 |
| id | student_id | subject_id | is_done |
|---|---|---|---|
| 1 | 3 | 1 | true |
| 2 | 4 | 1 | true |
| 3 | 2 | 1 | false |
| 4 | 2 | 2 | true |
| 5 | 1 | 1 | false |
| 6 | 1 | 2 | false |
| 7 | 5 | 2 | true |
| 8 | 5 | 1 | false |
| 9 | 3 | 2 | true |
| 10 | 4 | 2 | true |
Solve the following tasks for them:
Find the student with the highest GPA who passed at least one course and print his name and GPA.
Modify the previous problem so that you find the student with the lowest GPA who passed at least one course, and print his name and GPA.