Skip to content
GATEiit

GATE CSE 2018 Q51: Query not equivalent to r join selection on s using left outer join

Syllabus topic: Relational model: relational algebra, tuple calculus and SQL

Question

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: r⋈(σB<5(s))

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?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: C (official GATE 2018 final answer key)

Concept used: Because of the foreign key every r tuple matches some s tuple, so a left outer join with all of s equals the inner join, but a left outer join with a filtered s keeps unmatched r tuples padded with nulls.

Concept notes

Loading notes…

First step: Take an r tuple with B≥5 and check which of the four queries would still output it (with a null C).

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Relational model: relational algebra, tuple calculus and SQL

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2018 CS question paper and final answer key, organised by IIT Guwahati. Question paper · Answer key