DBI202_-_PE_-_SP_2025_-_s_2_3472.webp
ngoctyen85

DBI202_-_PE_-_SP_2025_-_s_2_3472.webp

Kizspy.me
Question 8:
Picture 7.1
Create a function named F1 which calculates and returns an integer number which is the
number of distinct patients who have been diagnosed a given diagnosis in a given year
(based on the RecordDate), where Diagnosis nvarchar(255) and year int are respectively the
first and the second input parameters of the function.
Zoom
7 of 7
Paper No: 2
For example, when we call the F1 function in the following query, the results must be shown
as in the following figure:
select distinct Diagnosis, YEAR(RecordDate) as Year, dbo.F1(Diagnosis,
YEAR(RecordDate)) as NumberOfPatients
from Medical Records
where RecordDate < '2022-01-01'
Diagnosis
Year NumberOfPatients
1
Allergy
2019 3
2
Allergy
2020 4
3
Allergy
2021 2
4
Arthritis
2019 3
Arthritio
20004
+ 95%
Close
Chưa có bình luận nào.

Thông tin

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

Share this media

Back
Bên trên Bottom