数据库第二章课后部分习题答案.docVIP

  • 74
  • 0
  • 约4.12千字
  • 约 4页
  • 2017-06-07 发布于重庆
  • 举报
数据库第二章课后部分习题答案

************************************************** 2.1 a. Πperson name employee ? manages ? manager_name employee2.person name∧employee.street employee2.street∧employee.city employee2.city ??employee2 employee b. The following solutions assume that all people work for exactly one company. If one allows people to appear in the database e.g. in employee but not appear in works, the problem is more complicated.We give solutions for this more realistic case later. Πperson name σcompany_name “First Bank Corporation” works If people may not work for any company: Πperson name employee ? Πperson name σ company name “First Bank Corporation” works c. Πperson_name works ? Πworks.person_name works? works.salary≤works2.salary∧pany name “Small Bank corporation” ??works2 works ************************************************** 2.2 a. r ?θ s ∪ r ? ΠR r ?θ s × null,null, . . ., null The tuple of nulls is of size equal to the number of attributes in S. b. r ?θ s ∪ null,null, . . ., null × s ? ΠS r ?θ s The tuple of nulls is of size equal to the number of attributes in R. c. r ?θ s ∪ null,null, . . ., null × s ? ΠS r ?θ s ∪ r ? ΠR r ?θ s × null,null, . . ., null The first tuple of nulls is of size equal to the number of attributes in R, and the second one is of size equal to the number of attributes in S. ************************************************** 2.3 a. employee ← Πperson name, street, ”Newtown” σperson name “Jones” employee ∪ employee ? σperson name “Jones” employee b. The update syntax allows reference to a single relation only. Since this update requires access to both the relation to be updated works and the manages relation, we must use several steps. First we identify the tuples of works to be updated and store them in a temporary relation t1 . Then we create a temporary relation containing the new tuples t2 . Finally, we delete the tuples in t1, fromworks and insert the tuples of t2. t1 ← Πworks.pe

文档评论(0)

1亿VIP精品文档

相关文档