13 TO
General S... 48
Keith Evans TO
Picture 6.1
Question 7:
Write a query to display, for each year of the appointments table, the total cost of tests conducted for appointments in this year of each of the five departments: 'Cardiology','Neurology', 'Pediatrics', 'Dermatology' and 'Oncology'. The results must include DepartmentID, Name, Year and TotalCost as shown in the following figure. For example, the first row in the figure indicates that the total cost for tests conducted for appointments in 2020 in the 'Cardiology' department is 915. Note that the TotalCost for a given department in a given year must be NULL if no test was performed in that year for appointments in that department (as shown in the 17th row of the figure).
Zoom
+ 100%
Close