Question

SELECT operation in SQL is equivalent to:

Choose one option
Official answer and solution
Official answer
D
From
Official GATE 2015 answer key

Solution

Relate the SQL SELECT clause to corresponding relational algebra operations and duplicate semantics.

In SQL, a query takes the form SELECT A, B FROM R WHERE condition:

  • The WHERE clause corresponds to the relational algebra selection (sigma\\sigma).
  • The SELECT list (SELECT A, B) extracts specified columns, which corresponds to the relational algebra projection (pi\\pi).
  • A critical difference is that relational algebra relations are sets (and projection automatically removes duplicate tuples), whereas SQL operates on multisets (bags) and retains duplicate rows unless DISTINCT is explicitly written.

Hence, the SELECT operation in SQL corresponds to the projection operation in relational algebra, except that SELECT in SQL retains duplicates (option D).

Final answer

D

Common trap

Confusing SQL SELECT with relational algebra selection sigma\\sigma, which corresponds to the WHERE filter clause.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 1
Question
17 of 65, printed as CS Q.7
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.