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 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

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.

Gkseries: Gkseries.com is a premier website to provide complete solution for online preparation of different competitive exams like UPSC, SBI PO, SBI clerical, PCS, IPS, IAS, IBPS PO, IBPS Clerical exam etc. & other graduate and post-graduate exams. Learn more on about us page