Practice mode DBMS and SQL

Relation R(A, B) contains tuples (1,x), (1,y) and (2,x). How many tuples are in the relational algebra result of projection on A, written pi_A(R)?

Correct answer B. 2

Explanation

Relational algebra works on sets, so projection keeps only the requested attributes and removes duplicate tuples. Projecting on A gives the values 1, 1 and 2, which collapse to {1, 2}: two tuples. The answer 3 is what SQL returns for SELECT A FROM R, because SQL tables are multisets and keep duplicates unless you write SELECT DISTINCT.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.