DBI202_-_FA_2024_-_PE_-_s_-_8_2894.webp
Hương Giang1

DBI202_-_FA_2024_-_PE_-_s_-_8_2894.webp

7 of 7
Paper No: 8
Create a function named F1 which calculates and returns an integer number which is the number of distinct patients having appointments with doctors of a given department, where departmentID int is the input parameter of the function.
For example, when we call the F1 function in the following query for calculating the number of distinct patients having appointments with the two departments 'Cardiology' and 'Pediatrics', the results must be shown as in the following figure:
select DepartmentID, Name, dbo. F1 (DepartmentID) as NumberOfPatients
from Departments
where Departments. Name in ('Cardiology', 'Pediatrics')
DepartmentID
1
3
Name
NumberOfPatients
Cardiology
37
Pediatrics
32
1
2
Zoom
Dicture01
+ 100%
Close

Thông tin

Category
DBI202
Thêm bởi
Hương Giang1
Ngày thêm
Lượt xem
3,700
Lượt bình luận
1
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
DBI202_-_FA_2024_-_PE_-_s_-_8_2894.webp
File size
185.7 KB
Dimensions
1920px x 803px

Share this media

Back
Bên trên Bottom