Question
SELECT operation in SQL is equivalent to:
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
WHEREclause corresponds to the relational algebra selection (). - The
SELECTlist (SELECT A, B) extracts specified columns, which corresponds to the relational algebra projection (). - 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
DISTINCTis 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).
D
Confusing SQL SELECT with relational algebra selection , 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.