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.

Take Mock Tests

Government Schemes Mock Test Start Test!
Political Science Mock Test – 42 Start Test
History Test – 190 Start Test
Quantitative Aptitude Test Start Test!
Data Interpretation - Mock Test Start Test!
General Awareness - Mock Test Start Test!
Reasoning Ability - Mock Test Start Test!
We will be happy to hear your thoughts

Leave a reply

Gkseries.com
Logo
Register New Account