Questions: Relational Algebra

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A query first joins a 1,000,000-row Employees table with a 500,000-row Transactions table, then filters for employees in department 'Engineering'. A database optimizer rewrites this to filter Employees first (returning ~5,000 rows) before performing the join. What principle justifies this rewrite?

AProjection elimination — removing unused columns reduces data size
BPushing selection down — applying filters early reduces rows flowing into expensive operations
CNatural join substitution — replacing Cartesian product with natural join avoids duplicates
DClosure property — operators always return relations, enabling any reorder
Question 2 Multiple Choice

A student writes π_{name}(Employees) and gets back 950 rows from a 1,000-row table. In SQL, SELECT name FROM Employees returns 1,000 rows. What explains the difference?

ASQL projection and relational algebra projection are computed differently — SQL is slower
BRelational algebra projection returns a set (no duplicates), while SQL SELECT returns a bag by default
CThe SQL query is incorrect; it should use DISTINCT to match relational algebra
DRelational algebra projection automatically joins with a key column to count rows
Question 3 True / False

The closure property of relational algebra means that operators can be arbitrarily nested and composed, feeding one operator's output into another's input.

TTrue
FFalse
Question 4 True / False

The natural join (⋈) between two relations produces the same result as a Cartesian product (×) when the relations share no attribute names.

TTrue
FFalse
Question 5 Short Answer

Why does the real power of relational algebra lie in query optimization rather than query writing, and what makes 'pushing selections before joins' a valid optimization?

Think about your answer, then reveal below.