Q. Consider the relations r(A, B) and s(B, C), where s.B is a primary key and r.B is a foreign key referencing s.B. Consider the query
Q:Β Β π β (ππ΅<5(π ))
Let LOJ denote the natural left outer-join operation. Assume that r and s contain no null values.
Which one of the following queries is NOT equivalent to Q?
(A) ππ΅<5(π β π ) (B) ππ΅<5(π πΏππ½ π )
(C) π πΏππ½ (ππ΅<5(π ))Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β (D) ππ΅<5(π) πΏππ½ π
Ans: π πΏππ½ (ππ΅<5(π ))Β Β
Sol:
Since, we are joining/LOJ using attribute B which is primary key of table s and foreign key of table r.
So, we need to apply condition ΟB<5 on left table of join always, i.e., table r because left outer join (LOJ) returns all the values from an inner join plus all values in the left table that do not match to the right table.