Correct option is D
The SQL query is:
SELECT X
FROM B
WHERE Y;
We need to translate this SQL query into relational algebra.
Step 1: Understand the WHERE clause
The WHERE Y condition filters the rows of relation B based on condition Y.
In relational algebra, selection is represented by:
Therefore, means select those tuples from B that satisfy condition Y.
Step 2: Understand the SELECT X clause
The SQL statement:
SELECT X
means that after filtering, we want only attribute X.
In relational algebra, projection is represented by: π
Therefore, means:
1. First select the tuples satisfying Y.
2. Then project attribute X.
Thus:
Information Booster
1. Selection → selects rows/tuples satisfying a condition.
2. Projection → selects columns/attributes.
3. SQL WHERE corresponds primarily to selection.
4. SQL SELECT of specific attributes corresponds to projection.
5. The usual order for this query is:
Additional Knowledge
The options can be eliminated as follows:
· (a) — projection is performed before applying the condition; generally not equivalent.
· (b) — selection and projection attributes are reversed.
· (c) — uses X as the selection condition rather than Y.