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, PhoneNumber, Email, DepartmentID)values (70,'Van Chien', 'Nguyen', '0928367812', '
[email protected]', null),(71,'Thi Binh', 'Nguyen', '0989278127', '
[email protected]',5)
select * from Doctors where DoctorID in (70,71)
DoctorID
70
71
FirstName
LastName
Phone Number Email
1
2
DepartmentID
0928367812
[email protected] 1
Van Chien Nguyen Thi Binh
Nguyen
0989278127
[email protected] 5
Question 10:
Zoom
Picture 9.1
+ 100%
Close