Which of the following relational algebraic expressions is equivalent to the SQL query SELECT X FROM B WHERE Y ?
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. πx(σy(B))
Explanation
The SQL query filters rows of B that satisfy condition Y (a selection on Y) and then returns only column X from the surviving rows (a projection onto X). In relational algebra this is written as the projection applied to the selection, i.e. πx(σy(B)), since the WHERE clause is always applied before the SELECT list restricts the output columns. The other options either apply projection before selection, or apply both operators on the same attribute, which does not correspond to this query.More Database Management Systems questions
- A safe expression in relational calculus is one that is guaranteed to yield
- In order to define the relationship between two entity sets, which of the following operations can be used?
- Which of the following are true? A. A database may have only one primary key B. Every key is a candidate key C. There can be multiple candi…
- What is the correct sequence of database design process? A. Create conceptual schema B. Data model mapping C. Requirements collection and a…
- Match the LIST-I with LIST-IILIST-I LIST-II A. Wait-for graph I. Holds all locks until it commits B. Precedence graph II. Holds write-locks…
- Consider the following three relations: Employee(eid, eName), Comp(cid, cName), Own(eid, cid). Which of the following relational algebra ex…