DBI202_-_FA_2024_-_PE_-_s_-_7_2889.webp
Thùy Dung1

DBI202_-_FA_2024_-_PE_-_s_-_7_2889.webp

For example, when we call the F2 function in the following query for calculating the number of distinct patients who were required to do each of the four tests with testID respectively 9,10, 11 and 12, the results must be shown as in the following figure:
select TestID, Name, dbo.F2(TestID) as NumberOfPatients
from Tests
where TestID in (9,10,11,12)
TestID
9
10
11
12
Name
NumberOfPatients
5
2
5
Thyroid Test
Liver Function Test
Kidney Function Test
Complete Blood Count 8
Picture 8.1
1
2
3
4
Question 9:
Create a trigger named insertDoctor for the INSERT statement on the "Doctors" table so that when we execute an insert statement to add one or more rows to the "Doctors" table, if any of the inserted rows have the DepartmentID as null, the system will automatically set the DepartmentID of those rows to the DepartmentID of the department named 'Cardiology'.
For example, if we execute the following statements to insert two doctors (one with DepartmentID=NULL and the other with DepartmentID=5) and then select these two doctors,we can see that the DepartmentID of the doctor with DepartmentID=null is set to the id of the
Close
+ 90%
Zoom
Chưa có bình luận nào.

Thông tin

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

Image metadata

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

Share this media

Back
Bên trên Bottom