Question: Below are two sample database tables (directory, attendance). In directory, each student is assigned to a teacher. In attendance, each student's tardiness (minutes_late) is recorded
Below are two sample database tables (directory, attendance). In directory, each student is assigned to a teacher. In attendance, each student's tardiness (minutes_late) is recorded per day Using SQL, please craft a query which show for each teacher, how many minutes late have their students been all semester.
| Table: directory | Table - attendance | |||
| teacher_id | student_id | student_id | minutes_late | |
| 3 | 1 | 9 | 4 | |
| 0 | 5 | 61 | 2 | |
| 3 | 9 | 41 | 7 | |
| 2 | 13 | 53 | 4 | |
| 3 | 17 | 5 | 7 | |
| 3 | 21 | 61 | 7 | |
| 1 | 25 | 5 | 10 | |
| 3 | 29 | 21 | 2 | |
| 3 | 33 | 37 | 4 | |
| 1 | 37 | 5 | 5 | |
| 2 | 41 | 61 | 4 | |
| 0 | 45 | 65 | 10 | |
| 3 | 49 | 65 | 6 | |
| 3 | 53 | 45 | 6 | |
| 1 | 57 | 21 | 6 | |
| 2 | 61 | 17 | 10 | |
| 2 | 65 | 49 | 7 | |
| 37 | 1 | |||
| 9 | 8 | |||
| 61 | 1 | |||
| 33 | 0 | |||
| 5 | 0 | |||
| 1 | 9 | |||
| 57 | 5 | |||
| 9 | 5 | |||
| 53 | 3 | |||
| 61 | 1 | |||
| 17 | 3 | |||
| 13 | 9 | |||
| 5 | 3 | |||
| 17 | 8 | |||
| 1 | 3 | |||
| 57 | 1 | |||
| 17 | 4 | |||
| 5 | 0 | |||
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
