DBI202_-_FA_2024_-_PE_-_s_-_12_2891.webp
Pride2003

DBI202_-_FA_2024_-_PE_-_s_-_12_2891.webp

Zoom
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 department named 'Cardiology' as shown in the following figure:
insert into Doctors (DoctorID, FirstName, LastName, Phone Number, Email, DepartmentID)
7 of 7
Paper No: 12
values (70,'Van Chien', 'Nguyen', '0928367812', '[email protected]', null),(71, 'Thi Binh', 'Nguyen', '0989278127', '[email protected]',5)

Close
+ 100%
Chưa có bình luận nào.

Thông tin

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

Image metadata

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

Share this media

Back
Bên trên Bottom