This is a correlation query .
It works as a nested for loop.
The above query can be visualised as---
For every entry in R1
{
check if (∃ tuple in R such that R1.A=R.B)
{ do not select the tuple
}
else
{print the tuple in output
}
}
In above statements R1.A is outer loop variable and R.B is inner loop variable.
Now while executing--->
For R1.A=1 ∃ R.B such that R1.A = R.B => not selected
For R1.A =2 ∃ R.B such that R1.A= R.B => not selected
For R1.A = 3 ∄ R.B such that R1.A = R.B => selected
For R1.A = 4 ∄ R.B such that R1.A = R.B => selected
..thus 2 tuples would be in output