🎴 Flashcard Mode

Test 2 - Databases | Computer Science(CS)

Card1 / 26
Mastered0
Review0
QuestionClick to flip

Given relations r(w,x) and s(y,z), the result of select distinct w,x from r,s is guaranteed to be the same as r, provided

AnswerClick to flip back
A
r has no duplicate and s is non empty
💡 Explanation:

The query selects all attributes of r. Since we have distinct in query, result can be equal to r only if r doesn’t have duplicates.If we do not give any attribute on which we want to join two tables, then the queries like above become equivalent to Cartesian product. Cartisian product of two sets will be empty if any of the two sets is empty. So, s should have atleast one record to get all rows of r.

Change Mode