I am a sophomore. In the recent period of time in the database review problems encountered a problem, as follows.
There is a relationship between SC (S_id,c_id,age,score), to find the number of students older than 22 years of age and scores, the correct relational algebraic expression is ().
Ⅰ.πs_id,score (σage>22 (SC))
Ⅱ.σage>22 (Πs_id,score (SC))
Ⅲ.πs_id,score (σage>22 (Πs_id,score,age (SC)))
The answer is I and III, and I did it myself at the time, three of them are correct. After reading the answer, always think I and II are not the same? Later Baidu, haha, this problem has appeared a lot, in different
The information, looked a lot, did not parse. For a time, Baidu has not helped me. Can only read the definition of the book by himself.
π, what is defined in the textbook is to take out the attribute columns to form a new relationship, or to form a new table. Suddenly, it dawned. If this is the case, in option II, first execute (πs_id,score (SC)) This sentence,
Then this new table there is no age column, only s_id and score, so, σage>22, in front of this sentence in a non-aging property of the table to do the row selection, which is naturally wrong.
The above is a subjective conjecture of the definition of a textbook. For verification, see III (ΣAGE>22 (Πs_id,score,age (SC)), which has an age column more than II. The results at a glance, above me
The resolution is likely to be correct.
An analysis of a database example. Why is the σage>22 (Πs_id,score (SC)) option wrong?