I created two tables using below command:
select top 20 ord_pk into temporders from orders
select top 20 ord_pk into temporders1 from orders
Now I changed the not null constraint of temporders1 table to allow null values and updated last 5 rows of temporders1 table with NULL.
Now when I am executing below query:
select ord_pk
from temporders
where temporders.ord_pk not in
(
select ord_pk from temporders1
)
It is returning no row as Output.
When I deleted all rows from temporders1 table which are having null value, it is returning last 5 Ord_Pk from temporders table.
I am not able to figure out why it is doing so because I had earlier checked that there was no primary key or any other constraint on any table(temporders and temporders1).
Please help me out to understand the logic behind it.